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-04-01 7:26 AM
The loop Chip VDD/Pin1 via C1 to chip VSS Pin32 seems large. Insufficient decoupling may lead to inconsistant behaviour.
Better do your first experiments with Nucleo boards, as they have all the infrastructure needed.
2025-04-01 9:24 AM
Compared to the reference schematics in " Getting started with STM32L4 Series and STM32L4+ Series
hardware development" App. Note: NRST does not have a pull-up R. NRST is a bidir pin which is pulled down from inside on reset. You may monitor NRST level with a scope.
hth
KnarfB
2025-04-01 1:51 PM
dear @JesFo
Indeed Reset circuit should be updated , please remove R1 and R2 resistors .
Cheers
STOne-32
2025-05-25 11:58 PM
Terribly sorry for the late reply. I've removed R1 and R2. Should I bridge NRST to high or low? Or should I leave it floating now that the resistors are removed?
2025-05-26 12:08 AM
I've completely disconnected NRST from anything. Probing it with a scope shows it rises to 3.3V when powered on.
2025-05-26 12:14 AM
I've already done my full project on the nucleo32L412 board. I'm doing this because I want to look into the low-power modes the MCU provides, and I want to evaluate these without any of the additional components added by the nucleo board. I haven't tried my full original project developed for the nucleo boards, but I intend to test it once I get something basic such as a blinking program working on the plain STM32L.
2025-05-26 7:43 AM
NRST needs a capacitor for "temporization", so that everything is already set up when reset releases. The capacitor will also inhibit short noise pulses on NRST
2025-05-26 10:20 PM
I have 100nF across NRST and ground.
2025-05-26 10:53 PM - edited 2025-05-26 10:59 PM
And still inconsistent boot? Hard to diagnose remotely. Double check the power supply or replace it by a lab power supply or batteries/coin cell etc.. C1 C2 shall be close to the chip, you may solder them directly on the adaptor board.
The STM32 Nucleo expansion board for power consumption measurement UM2243 User manual contains a chapter on how to prepare a Nucleo board for low power measurements.
hth
KnarfB