cancel
Showing results for 
Search instead for 
Did you mean: 

Debug doesn't work at KAIL. ''Could not stop Coretex-M device!''

Takayoshi Ishii
Associate III
Posted on February 28, 2018 at 12:21

Hello,

When I run my project as debug mode, following error come up.

------------------------------------

Debugger - Coretex-M Error

Could not stop Coretex-M device!

Please check the JTAG cable.

------------------------------------

I can debug other project by the same hard ware environment. I changed many times the debugger and cable, but the same error come up.

When I run it as LOAD and RUN, it works well. Just couldn't stop the debug mode running.

The environment is 

-STM32L051C8T6

-Kail v5.24

-Cube-MX

-ST-Link V2-1 and the setting speed is 1MHz for STM32L0.

Thank you.

12 REPLIES 12
Posted on February 28, 2018 at 12:42

Looks like a Custom board not the disco / nucleo one?

I believe that you selected st-link interface type in the the debugging option.

What sort of programmer / debugger do you use - please share model / vendor detail. Then use the ST-LINK utility to check the firmware version and if needed update it.

http://www.st.com/en/development-tools/stsw-link004.html

 
Andrew Neil
Evangelist III
Posted on February 28, 2018 at 12:47

You mean 'Keil' ?

I can debug other project by the same hard ware environment.

So, to be clear, other software works fine with the exact same target board, and the exact same debugger, cables, etc ?

Could not stop Coretex-M device!

You mean, 'Cortex' ?

Is the 'problem' code putting the CPU to sleep?

And/Or re-configuring the debug pins ?

AvaTar
Lead
Posted on February 28, 2018 at 13:12

-ST-Link V2-1 and the setting speed is 1MHz for STM32L0.

The embedded ST-Link is SWD-only, not JTAG. Check your debugger settings.

Only the stand-alone version of the ST-Link has JTAG capability.

Posted on February 28, 2018 at 12:43

Assumed the haw is upgradeable by the st-link. Segger is a difefrent story.

Posted on February 28, 2018 at 14:51

Try not letting the processor drop into low power modes, if it switches off the SWD pins/hardware connectivity will be lost. CM0 does not support JTAG.

Check available settings for DBGMCU to stop processor doing things in debug mode that would result in disconnections.

When doing low power debugging use a USART to provide debug/telemetry data so you can see what's happening in a non-invasive way. Use GPIO or other methods as most suitable. The debugger is more invasive than most people expect.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Takayoshi Ishii
Associate III
Posted on March 01, 2018 at 03:16

Hello, thank you all!

I made a custom board and I already have made over 10 custom board, but this is my first time to met this error.

I use ST-Link that is from Nucleo board. I cut it and use just St-Link parts. SWD connection. 

I checked ST-Link Utility, the version was v2,J28,M17  and I updated it to v2,J28,M18.

My program don't use any sleep or stop mode.

I was checking the hardware since last night, now 11 am, but now I doubt the software.

This is my code. I can stop by line 133, can reset, can run again. If I put a break point at line 134, I can not stop the debugging, but my board works well... Line 133 to 140 is made by Cube-MX.

0690X00000609rIQAQ.png

This is in the MX_GPIO_Init(). I can stop line 667, almost last part of the function but If I step next, I can not stop the debugging... 

0690X00000609ZzQAI.png
Takayoshi Ishii
Associate III
Posted on March 01, 2018 at 03:47

PB3 is connected to a FET gate. This is the same hardware design that I made already many times and working well except this project.

When I disconnect PB3 and FET physically, I could stop the debugging. Why...???

PA8 is also connecting to a FET gate and the MX setting code seems the same as PB3 setting. But PA8 doesn't have to disconnect, and I can stop the debugging...

Posted on March 01, 2018 at 04:04

PB3 is the SWO pin of the debug interface, although not used on CM0/CM0+ devices to the best of my knowledge.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Takayoshi Ishii
Associate III
Posted on March 01, 2018 at 08:48

Thank you Clive and Ava!

I don't use SWO line but I should not use PB3.

Thank you very much!

Takayoshi Ishii