Programming the Nucleo STM32L476
I have found it a bit confusing programming the Nucleo in the IDE's suggested from the site. I am use to the Arduino IDE as it is fairly easy to use. So, I found a way to program the Nucleo with the Arduino IDE. This was created by Srihari Koripalli who deserves all the credit for this.
Below is how it is done:
- Open the Arduino IDE
- Go to the "File" menu
- Go to "Preferences"
- Under "Additional Boards Manager URLs" enter the link below:
https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/master/STM32/package_stm_index.json
- Go to "Tools" menu, Click on "Board" then Click on "Boards Manager"
- Scroll down until you find the "STM32 Core" Package by ST-Microelectronics and install it. This will take a bit of time to install.
That is it for this part
- Next download the PinMap for the Nucleo Board to the Arduino IDE
https://github.com/sriksh9/Nucleo-PinMapping-for-Arduino
The PinMap is technically for the f401 board, but is the same for the L476 and does work
- Put the downloaded folder into the Arduino Library Folder (My directory is "C:\Program Files (X86)\Arduino\libraries")
- Next you will have to change the Board in the IDE to the correct Nucleo board by going to "Tools" - "Board" - Select the correct board type "Nucleo-64"
- Then select "Board Part Number" - Select "Nucleo L476RG" - Finally select the correct "Port" the board is attached to
This quick program blinks a light from "Pin D2" on the board (PinMap 1)
#include int a = pinMap(1); //pinMap(Mapped Pin) - for mapped pin refer the attacted image void setup() { pinMode(a, OUTPUT); } void loop() { digitalWrite(a, 1); delay(500); digitalWrite(a, 0); delay(500); }
I want to thank Srihari Koripalli for coming up with this!!
I hope this helps others with the programming of the board. It works great!!
Dale W
Top Comments