I know it uses an STM32L476, which is supported by STM32duino, but I haven’t even been able to get the LED to blink, even after adding the proper pin to the variant file.
Any help is greatly appreciated.
I don’t know/have this kit (I don’t know (yet
all the ST portfolio).
This is currently not planned to add it. I could help you if you want to add it.
some of the components are supported with Arduino libraries (LPS22HB, MP34DT04 (on going), …)
Anyway, I think, It should be possible to use the Nucleo-L476RG variant to add basic support.
Maybe the clock config is not correct that’s why the led is not blinking
Its a very capable little board, I’m looking forward to digging into it more. Incredible how much is crammed on that little tile. I’d love to add some basic support for this board – hopefully others could benefit from it as well.
Looking at the variant folder a little closer, it looks like I need to add the LED pins (PA14, and PG12) to more than just the variant.h file. I’ll do so tonight and report back. As far as clock configs go, I’ll have some reading to do as well.
Thanks again.
I am still working on getting the other LED on PG12 to blink.
Do not hesitate to do a PR on the github.
I’m currently on vacation. I could help more next week.
Enjoy your vacation!
As you can see in “Arduino_Core_STM32/system/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l476xx.h” you have:
#define GPIOG_BASE (AHB2PERIPH_BASE + 0x0000U)
and
#define GPIOG ((GPIO_TypeDef *) GPIOA_BASE)
In “stm32l4xx_hal_rcc.h” the “__HAL_RCC_GPIOG_CLK_ENABLE()” is defined:
https://github.com/stm32duino/Arduino_C … rcc.h#L784
In “PortNames.c” the “__HAL_RCC_GPIOG_CLK_ENABLE()” is called:
https://github.com/stm32duino/Arduino_C … mes.c#L136
Do you use blink example?
What error do you get?
Well if the GPIOG clock is already enabled, then I am at a loss for why this pin will not blink.
I am using the blink example, and it compiles and flashes without error.
void setup() {
pinMode(PG12, OUTPUT);
}
void loop(){
digitalWrite(PG12, HIGH);
delay(500);
digitalWrite(PG12, LOW);
delay(500);
}
Or it compiles without error?
‘PG12’ was not declared in this scope.
So you probably defined PG12 but apparently not ok.
Try with pin name PG_12 instead of PG12 in your blink sketch.
Also added a #define LED2 PG_12, and used LED2 in the sketch, that also compiled without error, but did not work either.
I added PG_12 to variant.cpp, and PG12 to variant.h, in the same position of the respective array.
That took care of the ” ‘PG12’ was not declared in this scope” error.
https://github.com/stm32duino/Arduino_C … mes.h#L151
I’ll have to play with it once I get home.
and try with PG_12 in your sketch.
So we can see if it works wit built-in PG_12.
Tried the PG_12 yesterday, same results – compiles but doesn’t do anything.
The LED is definitely tied to PG12 too, here is the schematic: http://www.st.com/content/ccc/resource/ … ematic.pdf
Also cross checked the BSP from ST, and they have LED2 tied to PG_12.
Did you add PG12 in variant.h before PEND ?
Did you add PG12 in variant.h before PEND ? – Yes
It is linked to SAI_SD of the SensorTile, so if it is set to low by it then the led will be always off.
Note: using PG_12 in the sketch is not correct as it is the PinName not the pin number.
One other try which could be done is to use directly the ST HAL, this bypass all Arduino API:
void setup() {
GPIO_InitTypeDef gpio_init_structure;
__HAL_RCC_GPIOG_CLK_ENABLE();
/* Configure the PG12 pin */
gpio_init_structure.Pin = GPIO_PIN_12;
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
gpio_init_structure.Pull = GPIO_PULLUP;
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOG, &gpio_init_structure);
}
// the loop function runs over and over again forever
void loop() {
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_12, GPIO_PIN_SET);
delay(1000); // wait for a second
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_12, GPIO_PIN_RESET);
delay(1000); // wait for a second
}
Looking through the schematic and the MEMS example provided by ST, it looks like the SAI_SD is connected to an audio chip. That said, I am leaving alone PG12 for now
Moving along though – PC0, PC1, and SWD pins all blink happily! A nice surprise after a little frustration
I am going to need to make my own variant in order for anything to be intuitive here.. And so the project commences!
http://www.st.com/resource/en/user_manu … 320099.pdf
For PG12, Logic level of this pins is referred to VDDIO2.
Power supply
The SensorTile board has the following input supply pins:
1. VIN is the input for the onboard voltage regulator generating 1.8 V (150 mA max).
2. VDDUSB is an input for the STM32L4 VDDUSB and VDDIO2 pins (to use the
STM32L4 USB OTG peripheral, VDDUSB must be ≥ 3 V)
which power supply you use?




