cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot connect SWD J-link GDB Server to STM32 MCU in stop mode

dadman
Associate II
Posted on January 31, 2014 at 17:50

Hi all,

I wrote a small program for testing a STM32L152CBT6 Stop Mode via command PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI).

The program switches to stop mode immediatelly after MCU starts and after 4 seconds the RTC clock IRQ wake up the MCU.

This sequence runs in while(1) cycle and writes via SWO ITM_SendChar sentences ''going to stop...'' and ''wake up''.

Everything works perfectly well BUT after I've disconnected SWD J-Link GDB Server it is not possible to connect again :-(.

The Segger J-link GDB server just writes:

3,3V 

...

Connecting to target...ERROR...Could not connect to target

Target connection failed. GDB Server will be closed.

...and GDB server finishes running.

I've tried various reset types in J-Link, J-LinkSTM32 for reset the MCU to default state but with no success.

I think the Debug engine is not running in stop mode and the J-Link GDB server cannot detect the target.

Please help me how can I reset the MCU a flash or erase the program in memory.

Thanks

jdx

#swd-stop-mode-stm32
4 REPLIES 4
chen
Associate II
Posted on January 31, 2014 at 18:01

Hi

Try this:

Use Boot0 and DFU to re-flash a different binary into the STM32 (one that does not put the STM32 into stop mode!).

dadman
Associate II
Posted on January 31, 2014 at 18:36

Do you think is it enough to just set boot0 to High which disables loadsing the program form flash memory and use SWD to write the program into the flash memory?

chen
Associate II
Posted on January 31, 2014 at 18:40

Hi

I hope so.

I think the problem is that your program is putting the processor into stop mode.

The debugger cannot connect to the processor because it is stopped.

dadman
Associate II
Posted on February 01, 2014 at 18:43

YES!!! It works!. 

So, the solution is:

- Set BOOT0 pin HIGH (in my case floating was enough)

- Now the MCU is ''connectable'' by SWD

- Flash working program

- Disconnect MCU

- Set BOOT0 to LOW

Done!

Thanks a lot!