2024-09-20 04:16 AM
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.
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
Please suggest a way so that we can flash the new firmware even when the device is in STOP mode or Sleep mode.
2024-09-20 04:24 AM
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
2024-09-20 04:51 AM
@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?
2024-09-20 04:58 AM
No, I have not disabled the SWD pins. I didn't know anything about Connect under reset can you elaborate about it.
2024-09-20 05:24 AM
2024-09-20 05:31 AM
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
2024-09-20 05:33 AM
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.
2024-09-20 05:36 AM
@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
2024-09-20 05:45 AM
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
2024-09-20 06:24 AM - edited 2024-09-20 06:32 AM
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?