cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging motor code Keil registers not updating when motor runs with J-link

BTrem.1
Senior II

I have motor code running on a STM32G431 MCU and am using Keil IDE with J-Link debugger. When the motor is stopped I can see timer registers updating and can inspect watch variables. I'm also have a simple uart command interface I use to start/stop the motor and read some variables.

When I start the motor the Keil IDE watch window stops updating. I have it set to periodic update under the View menu but nothing updates. I can still communicate over the uart interface but the J-link seems locked out. Is this a problem with priority level settings?

Also, if the motor code is already running I cannot connect with the J-link. I need to issue a command to stop the motor then I can connect the debugger and read registers or start the motor.

Any suggestions? ---- Right now I am very hampered in debugging the code under these conditions. I need some suggestions.

Adding info in edit:

  1. I wrote a uart command to display a memory location of a variable I want to track. When the motor is running I see the value from the uart changing as expected but the debugger is displaying AAAAAAAA in almost all watch points and peripheral reg.
  2. If I select the IDE Toolbox-->Update it does NOT perform a forced one time update. Everything stays AAAAAAAA.

Thanks,

BT

3 REPLIES 3
Laurent Ca...
Lead II

Dear @BTrem.1​ 

Can you detail your whole HW and SW setup? (including STM tools versions)

Best regards

==

Laurent Ca...

Hi,

My setup is the Keil MDK5 (5.33.0) Compiler/debugger using a Segger EDU JTAG interface (5-wire). The board is a custom design using the STM32G341 48-pin device. The motor is a BLDC (6-pole-pair) being driven by an STSPIN233 driver IC. The motor voltage bus is 5V, start current 500mA and run current 40mA. I'm using the ST Motor Control software to run an FOC algorithm with a 23kHz pwm frequency. I tried dropping the pwm to 16kHz just to see if computation time or EMI was a problem but saw no difference in results.

Additional info-

I tested tested the setup with a Segger J-Link Base unit (as opposed to EDU) and the debugger screen did not crash but I could still not update the windows, even using the Keil debugger button "Update windows". Someone told me the EDU has weaker drivers than the BASE unit.

I reviewed the schematic again and found 4 of the 5 JTAG lines also route several inches away to an FPGA. The FPGA pins are not assigned (high impedance?) but the extra traces are probably not good for reflections/termination. I'll see if I can cut the unwanted traces.