I'm debugging an issue on an STM32G431 (32bit M4 core) where when I start a motor the debugger crashes. By crashing I mean all windows turn to garbage and I no longer have debugger control of the MCU. Before I start the motor the JTAG runs fine and displays and updates windows as I would expect.
My question is do the five JTAG lines need any special configuring? I read in ref manual that after reset they come up in a mode to operate as JTAG pins so I am not doing anything with them in the code. Also, I do not have any external pull-ups or pull downs, as the reference manual says this is done in the MCU.
Do these pins need to be 'locked' so that other code cannot accidently change the configuration or write to them?
I am using Keil MDK5 latest version and the Segger J-Link EDU with latest drivers.
Thanks for your help,
I am not directly familiar with this device, but the symptoms you describe are typical of a locked system, whereby a memory access never returns and so the system is stuck in the middle of an instruction execution (a data abort would be a meaningful return), and so the debugger cannot regain control.
Unfortunately deciphering the cause will likely not be easy. I recommend setting a number of breakpoints to see how far into the code you get before this issue occurs - the issue could be anything from a read from a peripheral that does not respond, or perhaps a stack or heap overflow (though these often will result in data aborts, which would not lock the system)
You may wish to post your question to the STM32 forum if you have not already:
Ronan Synnott said:You may wish to post your question to the STM32 forum if you have not already
If specific configuration of the pins is required/possible, that would be manufacturer-specific - so not an ARM question.
In many cases it is possible to disable the debug access; eg, for low power, for security, or just to gain a few extra pins - but, again, this is manufacturer specific.
You also mention a motor - so there could also be hardware issues with noise, interference, supply spikes, droops , etc ...
ST's motor control forum:
The mechanical connector is specified by ARM (ARM-20).Setup times and hold times are measured with respect to 50% communication which will need a re-initialization of the JTAG interface and a re-start of the debug session.