cancel
Showing results for 
Search instead for 
Did you mean: 

Reprogram when MCU is in stop mode.

Decebalus
Associate II

Hello! I am using an STM32U545 and VS Code for programming. I am experiencing the following issue: I am working with STOP mode, and once the MCU enters this state, I can no longer reprogram it. When using STM32CubeIDE, I did not encounter this problem (I believe this is related to the connect-under-reset feature, which VS Code seems to lack when programming).

Is there anything I can do to avoid this issue, other than using STM32CubeProgrammer to erase the memory or adding a delay at the start of the program to give myself time to program the device after a manual reset?

1 REPLY 1
Andrew Neil
Super User

@Decebalus wrote:

 When using STM32CubeIDE, I did not encounter this problem (I believe this is related to the connect-under-reset feature, which VS Code seems to lack when programming).


Indeed: the debug is not accessible during Stop:

AndrewNeil_0-1768395497394.png

https://www.st.com/resource/en/reference_manual/rm0456-stm32u5-series-armbased-32bit-mcus-stmicroelectronics.pdf#page=3502

via: https://www.st.com/en/microcontrollers-microprocessors/stm32u535cb.html#documentation

 

Also, it's common to disable the debug pins (to save power) during low-power modes.

So you need to wake-up out of STOP before you can do anything with the debugger. A reset achieves this.

 


@Decebalus wrote:

adding a delay at the start of the program to give myself time to program the device after a manual reset?


That can be useful.

As the above screenshot says, There are also "emulation" options which allow the debug to remain active during low-power modes, but I don't know how you'd access them from VSCode. And, of course, you don't achieve the low power with these enabled!

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.