cancel
Showing results for 
Search instead for 
Did you mean: 

STOP2_Mode prevents me from programming the MCU using J-Link and STM32 Cube programmer

mayank__
Associate II

In my program, I implemented a sleep using the STOP2_Mode, and to wake the MCU again, I have to depend on interrupts and events. I have attached the image of the block of code which represents the STOP mode mechanism.

mayank___3-1726830819179.png

 

When the device gets in STOP mode or Sleep mode not able to flash the MCU at all using both J-Link and STM32 Cube programmer. Also referred to the community pages and came to know about the BOOT0 option bytes but after trying it still not able to resolve that issue. I tried to modify the option bytes using the STM32 Cube programmer

mayank___2-1726830807115.png

Please suggest a way so that we can flash the new firmware even when the device is in STOP mode or Sleep mode. 

 

 

9 REPLIES 9

If NRST is used, connect under reset can work if you don't immediately power off the circuits needed to communicate. 

Have some minimum delay in Reset_Handler or check GPIO, etc

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@mayank__ wrote:

In my program, I implemented a sleep using the STOP2_Mode,


Did you also disable the IO pins used by SWD ?

Do you use Connect Under Reset?

mayank__
Associate II

No, I have not disabled the SWD pins. I didn't know anything about Connect under reset can you elaborate about it.

If NRST is wired to the debug pod it can hold the device in reset whilst doing initial connection, and before your code running on it can interfere with the pins or power down

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mayank__
Associate II

I have properly configured the SWDIO and SWCLK pins in my project. Not facing any flashing issue after pressing the reset button on the board but when the MCU enters sleep mode the device cannot be flashed with new firmware. To flash again have to press the reset button again so that it exits the sleep mode.


@mayank__ wrote:

To flash again have to press the reset button again so that it exits the sleep mode.


Exactly - that's what 'Connect under reset' does!

This is why it's always good to include NRST in your SWD connection.

 

#ResetWithSWD

mayank__
Associate II

Where should we configure this NRST? Do we have to do it in the Pinout & configuration of the STM32 project or is there any hardware connection which have to be done to achieve this? 

Please provide technical details to do this

NRST is just the chip's standard reset pin

 

What's the full part number of the chip you're using?

Is it on an ST board, or a custom board?

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228