cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo F401R1 - Timer interrupt and lockup

THoyl.3
Associate

 I am using timer interrupts to read 2 optical encoders connected to 2 motors. Everything seems to run fine for a while, then I get a hard lockup and everything stops. The time can be 5 minutes or 2.5 hours. I installed and setup watchdog and when it does lockup, the watchdog triggers and reboots. Anyone seen this? Any suggestions on what to look for?

Watchdog is set for 10 seconds.

timer is configured as follows.

TIM_TypeDef *Instance = TIM5;

 HardwareTimer *MyTim = new HardwareTimer(Instance);

 MyTim->setOverflow(1000, HERTZ_FORMAT); // 1000Hz = 1ms, 2000Hz = 0.5ms

 MyTim->attachInterrupt(actuatorEncoderScan_ISR);

 MyTim->resume();

3 REPLIES 3

 > I get a hard lockup and everything stops

In debugger, where does the program end? In hardfault?

JW

THoyl.3
Associate

This is what I see in the fault analysis. Does this help?

11:35:07 : STM32CubeProgrammer Fault Analyzer

 11:35:07 : Execution Mode  : Handler

 11:35:07 : Bus Fault detected in instruction located at 0x0800AFFE

 11:35:07 : NVIC position : 50

 11:35:07 : PRECISERR : a data bus error has occurred, and the PC value stacked

 11:35:07 : for the exception return points to the instruction that caused the fault.

 11:35:07 : BFARVALID : BusFault Address Register holds a valid fault address: 0x74636120 

 11:35:07 : Hard Fault detected in instruction located at 0x0800AFFE

 11:35:07 : Faulty function called at this location 0x0800AFAB 

 11:35:07 : Hard Fault State Register information : 

 11:35:07 : FORCED : forced Hard Fault.

 11:35:07 : Exception return information : 

 11:35:07 : Return to Handler mode, exception return uses non-floating-point 

 11:35:07 : state from the MSP and execution uses MSP after return.

0693W00000bh8eNQAQ.png

OK so you have to look at the disasm, what instruction at 0x0800AFFE, in what function, why did it try to access address 0x74636120 (it will be in one of the registers and the offending instruction will try to ld (load) or st (store) using address from that register) and work back from there.

In other words, this is a bug in your program, and you need to debug it as usually.

JW