cancel
Showing results for 
Search instead for 
Did you mean: 

problem with debug

EBrz
Associate

hello everyone

I'm having problem with debugging stm32f103 blue pill with Keil 5.39 ans st-link v2 programmer.

my programmer work fine when i load code without debug on micro but when i want to go to debug mode, my code run till the line

__HAL_AFIO_REMAP_SWJ_NOJTAG();

and then go to the reset handler part and when it reach to the BX line in reset handler, micro will be halt and not go further anymore.

can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions

A lot of Blue Pills have fake parts, those are not supported by ST's tools.

Fake / clone parts don't function consistently with STM32F1 devices. 

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

View solution in original post

3 REPLIES 3

Why do you need to remap mid debug session?

Is the stack setup properly?

Does it go to the Hard Fault Handler? Perhaps instrument that so you know, debugger, or not.

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

actually, i am new in working with ST.

I just install the CubeMX and Keil and create a very simple program to test Debug.

This is my project on CubeMX. as you see i just change the sys configuration to SerialWire.

error3.png

in Keil, i

 1- Change arm compiler to version 6 because version 5 was not installed in new version of Keil.

 2- Set the optimization level to O0.

 3- in the St-Link Debugger setting, the Connect and Reset setting are Under Reset and autodetect respectively (other options were also tried, but the problem still existed) . in flash download tab Reset and Run option is enabled. and in Pack tab, I unchecked the Enable option because when it was checked, The program could not be loaded on the micro, and the error of the genuinity of the micro was received (when it is unchecked, program could load on micro and work fine without debug mode of course).

A lot of Blue Pills have fake parts, those are not supported by ST's tools.

Fake / clone parts don't function consistently with STM32F1 devices. 

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