2025-03-31 2:20 AM
Hello.
I'm struggling to get a plain STM32L412KBT6 to boot consistently into the user program. I'm working with the PlatformIO environment in VSCode. I've tried both the STM32-Cube, and the Arduino framework with similar results. Here is my platformio.ini:
[env:nucleo_l412kb]
platform = ststm32
board = nucleo_l412kb
framework = arduino
upload_protocol = stlink
My setup consists of a very basic breakout PCB for the MCU:
Which is roughly hooked up as follows:
Platformio output when uploading using STLinkV2:
CURRENT: upload_protocol = stlink
Uploading .pio\build\nucleo_l412kb\firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x1fff31f8 msp: 0x20001bb0
** Programming Started **
Warn : Adding extra erase range, 0x08002a80 .. 0x08002fff
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
And the config flags in STM32CubeProg:
The issue:
The MCU doesn't boot directly into the user program when powered up. Only when I wait around 2-minutes after powering the board and then give the NRST-pin a low signal for reset, the user program starts executing. The program also sometimes starts executing after uploading the program through STLink, but resetting the board results in having to power it down and repeat the 2-minute wait method mentioned above. I've tried this with 3 MCU:s with identical results.
2025-05-26 11:01 PM
Is 100nF good enough for these?
2025-05-26 11:17 PM
No luck. I soldered both directly to the adapter board. I'm fairly sure it has to do with NRST though, since once I detached my scope brobe from the pin it started working and kept rebooting consistently until I re-uploaded my program. After that it was back to it's old antics.