Skip to main content
Visitor II
July 14, 2020
Question

How to reset cpu after ending debug session with st-link?

  • July 14, 2020
  • 5 replies
  • 3665 views

I am facing a problem after I finish the debug session. Once I try to reset the cpu via the reset button or manually resetting the CPU via the ST-Link Utility the program does not start. The only way to start the program again is to click agian the debug option which reuploads the firmware to the MCU (STM32L431KB) and starts the gdb server via st-link.

Further information

When using the ST-Link utility and go to the Target>MCU Core.. option., I click the "System Reset" and the "Core State" is displayed as "Lockup".

Debug Setup

ST-LINK FW : V2J36M26

Connect mode: Under Reset

Reset mode : Hardware reset

STM32CubeProgrammer v2.4.0  

GDB server. Version 5.5.0

    This topic has been closed for replies.

    5 replies

    Super User
    July 14, 2020

    Custom board? Is BOOT0 pulled down?

    VC.1Author
    Visitor II
    July 15, 2020

    Yes I have the MCU pin Boot0 pulled down. I was able to debug and reset the CPU without a problem. I changed from Atollic 9.3 to STCMCube IDE and updated the ST-Link firmware and now this is happening.

    Visitor II
    July 15, 2020

    if your code doesn t have stop modes, try sw reset by swd. also if you disconnect stlink, check if using stlink rx pullup or mco clock.

    Graduate II
    July 15, 2020

    BOOT0 state is one potential issue. Having NRST driven high by a push-pull driver can be another.

    Code also might actually be starting, check it is not dying in ErrorHandler(), HardFault_Handler(), or some other while(1) loop

    VC.1Author
    Visitor II
    July 15, 2020

    I made a new project and it works as expected. The only difference is that in my project I have modified the Flash Address in the linker script as

    FLASH (rx) : ORIGIN = 0x8008000, LENGTH = 94K

    And the "system_stm32l4xx.c" file with

    #define VECT_TAB_OFFSET 0x8000

    I suspect that the MCU does not start at address 0x8008000 when resetting. I had this working with atollic but when migrating to STM32Cubeide this has for some reasone caused a problem.

    Graduate II
    July 15, 2020

    Yes the processor isn't going to start from there, you'd need a boot loader at 0x08000000 to transfer control elsewhere.​

    Visitor II
    July 15, 2020

    Ok I will have to check if the bootloader is working. Now that I think about it .... it might have been that I erased the chip completely so the bootloader is gone...

    VC.1Author
    Visitor II
    July 15, 2020

    Ok I have just reflashed the bootloader I had and now I can reset the MCU. thanks a lot!