Skip to main content
Visitor II
September 20, 2024
Question

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

  • September 20, 2024
  • 5 replies
  • 1903 views

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. 

 

 

    This topic has been closed for replies.

    5 replies

    Graduate II
    September 20, 2024

    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

    Super User
    September 20, 2024

    @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__Author
    Visitor II
    September 20, 2024

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

    mayank__Author
    Visitor II
    September 20, 2024

    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.

    Super User
    September 20, 2024

    @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__Author
    Visitor II
    September 20, 2024

    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

    Super User
    September 20, 2024

    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