ESP32 sending medium sized JPEG picture - Interrupt wdt timeout on CPU1

WintermuteAI
Posts: 1
Joined: Sun Dec 08, 2019 7:57 am

ESP32 sending medium sized JPEG picture - Interrupt wdt timeout on CPU1

Postby WintermuteAI » Sun Dec 08, 2019 8:10 am

I'm receiving JPG picture from a device connected to ESP32 with serial connection (baud rate 921600). Receiving part is done using the following code:
  1. if (String(topic) == "esp32/face_enroll") {
  2.  
  3. /*here is some code related to getting message from the device and parsing it, I omit it because this part works as expected*/
  4.  
  5. byte incomingByte = 0;
  6. byte nextByte = 0;
  7. bool jpeg = 0;
  8. byte jpeg_image[50000];
  9. int i=0;
  10.  
  11. Serial.println("init");
  12. if (mf1_jpeg.available() > 0)
  13. {
  14.   Serial.println("data");
  15.   incomingByte = mf1_jpeg.read();
  16.   if (incomingByte == 0xFF)
  17.     { nextByte = mf1_jpeg.read();
  18.       if (nextByte == 0xD8) {   jpeg = 1; i = 2; jpeg_image[0]=incomingByte; jpeg_image[1]=nextByte; Serial.println("jpg begin");}
  19.     }
  20. }
  21.  
  22. while (jpeg)
  23. {
  24.   incomingByte = mf1_jpeg.read();
  25.   jpeg_image[i]=incomingByte;
  26.   i++;
  27.  
  28.   if (incomingByte == 0xFF)
  29.     { nextByte = mf1_jpeg.read();
  30.       if (nextByte == 0xD9) {
  31.         jpeg = 0;
  32.         jpeg_image[i]=nextByte;
  33.               Serial.println("jpg end");
  34.  
  35.              
  36.       //client.publish("esp32/jpg", jpeg_image, 50000, false);
  37.                
  38.                 Serial.println("finished");  
  39.  }
  40.     }
  41. }
  42.       break;}
  43.      }
  44.     if (!detected) { client.publish("esp32/result", "no_face_detected"); Serial.println("no_face_detected");}
  45.     detected = 0;
  46. delay(5);
  47.     }
If the line about publishing is commented out, I can receive messages from the device, including jpg, which appears to be not corrupted (begins with ff d8 and ends with ff d9). If I try sending the jpg with client.publish(using pubsubclient library for Arduino), then esp 32 immediately after receiving message on face_enroll topic reboots with the following backtrace:

Code: Select all

Connecting to orangepi
...
WiFi connected
IP address: 
192.168.43.159
Attempting MQTT connection...connected
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x40081372  PS      : 0x00050034  A0      : 0x40084774  A1      : 0x3ffbe7a0  
A2      : 0x3ffbec00  A3      : 0x00000000  A4      : 0x00000001  A5      : 0x4008b2e0  
A6      : 0x00000004  A7      : 0x3ffb8614  A8      : 0x3ff40000  A9      : 0x00000008  
A10     : 0x00000000  A11     : 0x00000200  A12     : 0x00000000  A13     : 0x3ffb1db0  
A14     : 0x3ffb8000  A15     : 0xbaad5678  SAR     : 0x00000013  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
Core 1 was running in ISR context:
EPC1    : 0x4000bff0  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x40081372

Backtrace: 0x40081372:0x3ffbe7a0 0x40084771:0x3ffbe7d0 0x4000bfed:0x3ffb1e00 0x40089ce9:0x3ffb1e10 0x400d8547:0x3ffb1e30 0x400d859d:0x3ffb1e70 0x400d47d9:0x3ffb1ea0 0x400d48c7:0x3ffb1ec0 0x400d4c9e:0x3ffb1ee0 0x400d3986:0x3ffb1f20 0x400d1029:0x3ffb1f60 0x400d4e6f:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0

Core 0 register dump:
PC      : 0x4013e01a  PS      : 0x00060134  A0      : 0x800d7d12  A1      : 0x3ffbbff0  
A2      : 0x00000000  A3      : 0x00000001  A4      : 0x00000000  A5      : 0x00000001  
A6      : 0x00060320  A7      : 0x00000000  A8      : 0x800d6d5a  A9      : 0x3ffbbfc0  
A10     : 0x00000000  A11     : 0x40084f14  A12     : 0x00060320  A13     : 0x3ffbb650  
A14     : 0x3ff000e0  A15     : 0x00000001  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

Backtrace: 0x4013e01a:0x3ffbbff0 0x400d7d0f:0x3ffbc010 0x4008a361:0x3ffbc030 0x40088b7d:0x3ffbc050

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x40081346  PS      : 0x00050034  A0      : 0x40084774  A1      : 0x3ffbe7a0  
A2      : 0x3ffbec28  A3      : 0x00000002  A4      : 0x00000001  A5      : 0x4008b2e0  
A6      : 0x00000004  A7      : 0x3ffb8614  A8      : 0x00000000  A9      : 0x3ff50000  
A10     : 0x00000200  A11     : 0x00000200  A12     : 0x00000000  A13     : 0x3ffb1db0  
A14     : 0x3ffb8000  A15     : 0xbaad5678  SAR     : 0x00000013  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
Core 1 was running in ISR context:
EPC1    : 0x4000bff0  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x40081346

Backtrace: 0x40081346:0x3ffbe7a0 0x40084771:0x3ffbe7d0 0x4000bfed:0x3ffb1e00 0x40089ce9:0x3ffb1e10 0x400d8547:0x3ffb1e30 0x400d859d:0x3ffb1e70 0x400d47d9:0x3ffb1ea0 0x400d48c7:0x3ffb1ec0 0x400d4c9e:0x3ffb1ee0 0x400d3986:0x3ffb1f20 0x400d1029:0x3ffb1f60 0x400d4e6f:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0

Core 0 register dump:
PC      : 0x4013e01a  PS      : 0x00060134  A0      : 0x800d7d12  A1      : 0x3ffbbff0  
A2      : 0x00000000  A3      : 0x00000001  A4      : 0x00000000  A5      : 0x00000001  
A6      : 0x00060120  A7      : 0x00000000  A8      : 0x800d6d5a  A9      : 0x3ffbbfc0  
A10     : 0x00000000  A11     : 0x40084f14  A12     : 0x00060120  A13     : 0x3ffbb6c0  
A14     : 0x00000000  A15     : 0x3ffbbce0  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

Backtrace: 0x4013e01a:0x3ffbbff0 0x400d7d0f:0x3ffbc010 0x4008a361:0x3ffbc030 0x40088b7d:0x3ffbc050

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

Connecting to orangepi
...
The MQTT_MAX_PACKET_SIZE is set to 50000(changing it to 55000 doesn't make a difference). I have also tried publishing with client.beginPublish and write(payload, length) (or write(payload to send single bytes), all with the same result...

What I found working, sort of, is publishing bytes of jpg image right after receiving them from the device, or buffering them to buf[5000] array and then publishing them. Unfortunately the jpg image is corrupted when publishing this way (a lot of ff bytes in the body of jpg, doesn't end with ff d9, impossible to open).

Is there any work around this issue? It doesn't seem to be memory related...

Who is online

Users browsing this forum: No registered users and 30 guests