Day: November 4, 2017

Programming the Nucleo-L476RG with OpenOCD

I decide to use the Nucleo-L476RG board (MB1136 C-04) to test NuttX. This is the same board that Mihail is using to create his nice tutorials:

It comes with a detachable (“break apart”, please don’t do it) stlink-v2.1 programmer, but I didn’t get it working with OpenOCD, then I decided to use an external stlink-v2 clone to program it.

All you need to do is connect the SWDIO pin from programmer to pin PA13 (CN7 pin 13), SWCLK pin to PA14 (CN7 pin 15) and the GND pin (i.e. CN7 pin 20).

The command to flash the nuttx.bin firmware was this one:

 $ sudo openocd -f interface/stlink-v2.cfg -f target/stm32l4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"

Now just open the minicom configuring it to use the STLInk Debug port (ttyACM0).

Update: today testing the about OpenOCD command again using the stlink-v2.1 existent in the board it worked fine. Using “Open On-Chip Debugger 0.10.0+dev-00376-g3d3b45a (2018-04-03-20:18)”

Update2: It is a good idea to do a firmware upgrade to STSW-LINK007