2022-11-04 07:37 AM
I'm working on making a custom PCB using an STM32L5xx board field-updatable. To that end, I've configured the option bits according to pattern 12 from AN2606:
TZEN = 0, nBoot0(bit) = 0, nSWBoot0(bit) = 0, NSBOOTADD1[24:0] = 0x017F200.
With this setup, the microcontroller will always start and reset to bootloader mode, which I do think is a good thing for now. It should help protect against the a problem in application mode bricking the microcontroller and needing to use a debugger to fix it.
I've been using the NUCLEO-144 L552ZET6Q to test/debug this method. When the uC is in bootloader mode, the red and blue user LEDs turn on, and switching back to application mode will turn them off.
To switch to application mode, I've tried to use CubeProgammer CLI to start the application mode, which it does seem to do, only for it to be forced back into bootloader mode.
If I try to run this via USB DFU, it looks like it has the same effect, with the difference of there being an error in the DFU (likely the uC changing from DFU to CDC). When I run this command on both SWD and USB DFU, the red and blue LEDs turn off for a moment, then quickly turn back on.
Also, I've tried running the same command at a the address for main() and a few others to experiment, but that throws this error:
I don't have a lot of experience with switching between application and bootloader modes, so any advice is appreciated.
Solved! Go to Solution.
2022-11-04 08:35 AM
I figured it out! This post solved it!
Now I can start in bootloader mode and switch using CLI!
2022-11-04 07:54 AM
Your idea isnt good = for every start if works you need run CLI connected command.
Normal use is HW jumper on BOOT0 pin. Then NSBOOTADDR0 and NSBOOTADDR1 swith apps.
Too OB nBOOT0 can be used instead jumper...
2022-11-04 08:17 AM
That's a lot of word spaghetti I'm having trouble untangling. How would having the BOOT0 pin constantly being pulled high be any different from my current setup? Do you mean have a button or wire on-board to engage bootloader mode whenever I want? Because, to me, that completely ignores what I'm trying to do with this setup: start in bootloader mode for safety, then switch to application mode.
2022-11-04 08:35 AM
I figured it out! This post solved it!
Now I can start in bootloader mode and switch using CLI!
2022-11-04 12:07 PM
Good for you , but i only explain , that jump to app works ok (i use it daily)
And simple use is over SWD program NSBOOTADD0 and 1 once and in your app code for switch into bootloader reprogramm in app only OB nBOOT0ofcourse one ADDR 0X8000000 plus after start using CLI app reprogramm in app OB nBOOT0 back...