cancel
Showing results for 
Search instead for 
Did you mean: 

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

VC.1
Associate II

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

8 REPLIES 8
TDK
Guru

Custom board? Is BOOT0 pulled down?

If you feel a post has answered your question, please click "Accept as Solution".
S.Ma
Principal

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.

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

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

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.

VC.1
Associate II

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.

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

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

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.1
Associate II

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