cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a possibility to read program counter via ST-Link or J-Link without causing a reset on STM32F103 devices with RDP active?

stst9185
Associate III

On a serial product after a firmware update, there are some sporadic cases, where we get a hang up situation. It would be very helpful to know where exactly the program is stuck. According to ES0346 Rev. 6 chapter 2.8 it is possible to access program counter even with RDP set. How can I exactly read the value with CubeProgrammer + ST-Link (or alternatively with J-Link).

13 REPLIES 13

I'd use an EXTI interrupt.

Another way may be to focus on the stack frame.

>>PC is always FFFFFFFE?

Sure it is not vectoring out of blank Flash?

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

Yes of course I have tried this as well, but my problem is, that the hang-up is not frequently enough to have a realistic chance to get it in the debugger, but it is too often for accepting it for our customers.

Thanks for the tip, I didn´t recognize this first. I still wonder why there seems to be a reset although the mode setting is HOTPLUG.

That Flash is not blank is sure, as after a reset the program operates normally. Stack seems to have no problem, as the area is pre-filled with a pattern and so an overflow can be excluded.

But what exactly do you mean with "I´d use an EXTI Interrupt"? It would be nice to have the possibility to generate an EXTI in the hangup-case and then to check what´s on the stack, but the problem is, that the hangup is very seldom and so it´s difficult to get the situation on my development place.

But I instrumented my code with IWDG functionality now and all exceptions will directly lead to a reset, so I hope, the problem can be solved this way.

Thanks for the support!