ESP32 crash when use external interrupt and timer interrupt

thinh1234
Posts: 1
Joined: Wed Nov 01, 2023 9:15 am

ESP32 crash when use external interrupt and timer interrupt

Postby thinh1234 » Wed Nov 01, 2023 9:29 am

When i use 2 external Interrupt and Hardware timer interrupt my program crash and get error when i increase motor speed
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Code: Select all

Core  1 register dump:
PC      : 0x400848ac  PS      : 0x00050031  A0      : 0x800d1976  A1      : 0x3ffbf34c  
A2      : 0x00000010  A3      : 0x00018010  A4      : 0x000637ff  A5      : 0x3ffbf32c  
A6      : 0x00000008  A7      : 0x3ffbdc2c  A8      : 0x00000000  A9      : 0x00000000  
A10     : 0x000000c8  A11     : 0x3ffc244c  A12     : 0x80081419  A13     : 0x3ffbf30c  
A14     : 0x3ffc2440  A15     : 0xfffffbff  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x800d1982  LBEG    : 0x400843d1  LEND    : 0x400843d9  LCOUNT  : 0x00000027  
Backtrace: 0x400848a9:0x3ffbf34c |<-CORRUPTED
My first thought was that the interrupt execution time was over so i increase interrupt timer but still the same. And i found that in file encoders.cpp inside function update_encoder() when i comment out

Code: Select all

s_robot_fwd_increment = 0.5 * (right_change + left_change);
  s_robot_rot_increment = (right_change - left_change) * DEG_PER_MM_DIFFERENCE;
  speed_robot_now=s_robot_fwd_increment*LOOP_FREQUENCY;
  s_robot_position += s_robot_fwd_increment;
  s_robot_angle += s_robot_rot_increment; 
And my program worked. So what happend here? and how can i fixed that.
https://github.com/thinhredbull1/mms/tree/main
Here is my Code link.

Who is online

Users browsing this forum: No registered users and 88 guests