Page 1 of 1

Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).

Posted: Tue Jun 18, 2024 12:45 pm
by Jamespeed44
hi,
my project have this error like 10 mins after the code is running and its looping, like the code running again but then 10 mins later error again
  1. Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1).
  2.  
  3. Core  1 register dump:
  4. PC      : 0x400d3160  PS      : 0x00060035  A0      : 0x800d2c78  A1      : 0x3ffc54e0  
  5. A2      : 0x000032b2  A3      : 0x00000001  A4      : 0x3ffc1c60  A5      : 0x00000001  
  6. A6      : 0x00060420  A7      : 0x00000001  A8      : 0x800d2b80  A9      : 0x000032b2  
  7. A10     : 0x00000005  A11     : 0x00000000  A12     : 0x011142e5  A13     : 0x00000020  
  8. A14     : 0x00000028  A15     : 0x003fffff  SAR     : 0x00000005  EXCCAUSE: 0x00000006  
  9. EXCVADDR: 0x00000000  LBEG    : 0x40085751  LEND    : 0x40085759  LCOUNT  : 0x00000027  
  10.  
  11.  
  12. Backtrace: 0x400d315d:0x3ffc54e0 0x400d2c75:0x3ffc5500 0x400d2e69:0x3ffc5660 0x400d167b:0x3ffc5680 0x400d170b:0x3ffc56a0 0x400d4225:0x3ffc56c0
  13.  
  14.  
  15. Core  0 register dump:
  16. PC      : 0x400f5b7e  PS      : 0x00060535  A0      : 0x800dc4d1  A1      : 0x3ffbcec0  
  17. A2      : 0x00000000  A3      : 0x40086c94  A4      : 0x00060520  A5      : 0x80000000  
  18. A6      : 0x007bf398  A7      : 0x003fffff  A8      : 0x800dc0d2  A9      : 0x3ffbce90  
  19. A10     : 0x00000000  A11     : 0x3ffbf394  A12     : 0x3ffbf394  A13     : 0x00000000  
  20. A14     : 0x00060520  A15     : 0x00000000  SAR     : 0x0000001d  EXCCAUSE: 0x00000006  
  21. EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
  22.  
  23.  
  24. Backtrace: 0x400f5b7b:0x3ffbcec0 0x400dc4ce:0x3ffbcee0 0x4008aa41:0x3ffbcf00
  25.  
  26.  
  27.  
  28.  
  29. ELF file SHA256: edb769177ab717cc
  30.  
  31. Rebooting...
  32. ets Jul 29 2019 12:21:46
  33.  
  34. rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
  35. configsip: 0, SPIWP:0xee
  36. clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  37. mode:DIO, clock div:1
  38. load:0x3fff0030,len:1344
  39. load:0x40078000,len:13964
  40. load:0x40080400,len:3600
  41. entry 0x400805f0
  42. E (100) psram: PSRAM ID read error: 0xfffffff
and this is the code i use
  1.  //#define BLYNK_TEMPLATE_ID "TMPL6S4jVtrpE"
  2. //#define BLYNK_TEMPLATE_NAME "Power Box"
  3. //#define BLYNK_AUTH_TOKEN "aW3hlV_wLSxG5jDedw6Re_DLOdcn3S8V"
  4. //#define BLYNK_PRINT Serial
  5.  
  6. //#include <WiFi.h>
  7. //#include <WiFiClient.h>
  8. //#include <BlynkSimpleEsp32.h>
  9. #include <PZEM004Tv30.h>
  10. #include <ModbusMasterPzem017.h>
  11. #include <LiquidCrystal_I2C.h>
  12. #include "DHT.h"
  13.  
  14. //char auth[] = BLYNK_AUTH_TOKEN ;     // Put in the Auth Token for the project from Blynk. You should receive it in your email.
  15. //char ssid[] = "admin";                  // Key in your wifi name. You can check with your smart phone for your wifi name
  16. //char pass[] = "admin123";
  17.  
  18. static uint8_t pzemSlaveAddr = 0x01; //PZem Address
  19. static uint16_t NewshuntAddr = 0x0001;      // Declare your external shunt value. Default is 100A, replace to "0x0001" if using 50A shunt, 0x0002 is for 200A, 0x0003 is for 300A
  20. #define RXD1 33
  21. #define TXD1 32
  22. #define PZEM_SERIAL Serial2
  23. #define DHTTYPE DHT22
  24.  
  25. const int DHTPIN = 5;
  26. const int relay = 18;
  27. float pwr;
  28. float randnum;
  29. float PZEMVoltage = 0;
  30. float PZEMCurrent = 0;
  31. float PZEMPower = 0;
  32. float PZEMEnergy = 0;
  33. float vr, ir, freq, pf_r, energy, power;
  34. float t, h;
  35. uint8_t result;
  36.  
  37. ModbusMaster node;
  38. //BlynkTimer timer;
  39. LiquidCrystal_I2C lcd(0x27, 20, 4);
  40. PZEM004Tv30 pzem_r(PZEM_SERIAL, RXD1, TXD1);
  41. DHT dht(DHTPIN, DHTTYPE);
  42.  
  43. void baca_pzemdc() {
  44.   result = node.readInputRegisters(0x0000, 6);
  45. }
  46.  
  47. void baca_pzem() {
  48.   vr = pzem_r.voltage();
  49.   ir = pzem_r.current();
  50.   freq = pzem_r.frequency();
  51.   pf_r = pzem_r.pf();
  52.   power = pzem_r.power();
  53.   energy = pzem_r.energy();
  54. }
  55.  
  56. void setShunt(uint8_t slaveAddr) {
  57.   static uint8_t SlaveParameter = 0x06;                                                             /* Write command code to PZEM */
  58.   static uint16_t registerAddress = 0x0003;                                                         /* change shunt register address command code */
  59.  
  60.   uint16_t u16CRC = 0xFFFF;                                                                         /* declare CRC check 16 bits*/
  61.   u16CRC = crc16_update(u16CRC, slaveAddr);                                                         // Calculate the crc16 over the 6bytes to be send
  62.   u16CRC = crc16_update(u16CRC, SlaveParameter);
  63.   u16CRC = crc16_update(u16CRC, highByte(registerAddress));
  64.   u16CRC = crc16_update(u16CRC, lowByte(registerAddress));
  65.   u16CRC = crc16_update(u16CRC, highByte(NewshuntAddr));
  66.   u16CRC = crc16_update(u16CRC, lowByte(NewshuntAddr));
  67.  
  68.   Serial.println("Change shunt address");
  69.   Serial1.write(slaveAddr); //these whole process code sequence refer to manual
  70.   Serial1.write(SlaveParameter);
  71.   Serial1.write(highByte(registerAddress));
  72.   Serial1.write(lowByte(registerAddress));
  73.   Serial1.write(highByte(NewshuntAddr));
  74.   Serial1.write(lowByte(NewshuntAddr));
  75.   Serial1.write(lowByte(u16CRC));
  76.   Serial1.write(highByte(u16CRC));
  77.   delay(10); delay(100);
  78.   while (Serial1.available()) {
  79.     Serial.print(char(Serial1 .read()), HEX); //Prints the response and display on Serial Monitor (Serial)
  80.     Serial.print(" ");
  81.   }
  82.  
  83. } //setShunt Ends
  84.  
  85. //void sendSensor() {
  86. //  h = dht.readHumidity();
  87. //  t = dht.readTemperature();
  88. //  if (isnan(h) || isnan(t)) {
  89. //    Serial.println(F("Failed to read from DHT sensor!"));
  90. //    return;
  91. //  }
  92. //  //  Blynk.virtualWrite(V0, PZEMVoltage);
  93. //  //  Blynk.virtualWrite(V1, PZEMCurrent);
  94. //  //  Blynk.virtualWrite(V2, pwr);
  95. //  //  Blynk.virtualWrite(V5, vr);
  96. //  //  Blynk.virtualWrite(V6, ir);
  97. //  //  Blynk.virtualWrite(V7, power);
  98. //}
  99.  
  100. void setup() {
  101.   Serial.begin(115200);
  102.   dht.begin();
  103.   lcd.init();
  104.   lcd.backlight();
  105.   Serial2.begin(9600, SERIAL_8N2, RXD1, TXD1);
  106.   Serial1.begin(9600, SERIAL_8N2, 26, 27);
  107.   setShunt(pzemSlaveAddr);
  108.   node.begin(pzemSlaveAddr, Serial1);
  109.   //  Blynk.begin(auth, ssid, pass);
  110.   //  timer.setInterval(100L, sendSensor);
  111.   pinMode(relay, OUTPUT);
  112.   digitalWrite(relay, HIGH);
  113.   lcd.setCursor(0, 0); lcd.print("Standby...");
  114.   delay(1000);
  115.   lcd.clear();
  116. }
  117.  
  118. void loop() {
  119.   //  Blynk.run();
  120.   //  timer.run();
  121.   //  sendSensor();
  122.   baca_pzem();
  123.   baca_pzemdc();
  124.   //  setShunt();
  125.  
  126.   h = dht.readHumidity();
  127.   t = dht.readTemperature();
  128.   if (isnan(h) || isnan(t)) {
  129.     Serial.println(F("Failed to read from DHT sensor!"));
  130.     return;
  131.   }
  132.   if (t < 30) {
  133.     digitalWrite(relay, LOW);
  134.   }
  135.   else {
  136.     digitalWrite(relay, HIGH);
  137.   }
  138.  
  139.   lcd.setCursor(0, 0); lcd.print("DCV:"); lcd.print(PZEMVoltage, 1); lcd.print(" V  ");
  140.   lcd.setCursor(8, 0); lcd.print("DCCur:"); lcd.print(PZEMCurrent, 3); lcd.print("A ");
  141.   lcd.setCursor(0, 1); lcd.print("DCPow:"); lcd.print(pwr, 2); lcd.print(" W  ");
  142.   lcd.setCursor(0, 2); lcd.print("ACV:"); lcd.print(vr, 1); lcd.print(" V  ");
  143.   lcd.setCursor(8, 2); lcd.print("ACCur:"); lcd.print(ir, 3); lcd.print("A ");
  144.   lcd.setCursor(8, 1); lcd.print("ACPow: "); lcd.print(power, 2); lcd.print(" W  ");
  145.  
  146.   if (result == node.ku8MBSuccess) {
  147.     uint32_t tempdouble = 0x00000000;
  148.     PZEMVoltage = node.getResponseBuffer(0x0000) / 100.0;
  149.     PZEMCurrent = (node.getResponseBuffer(0x0001) / 100.0);
  150.     tempdouble =  (node.getResponseBuffer(0x0003) << 16) + node.getResponseBuffer(0x0002); // get the power value. Power value is consists of 2 parts (2 digits of 16 bits in front and 2 digits of 16 bits at the back) and combine them to an unsigned 32bit
  151.     PZEMPower = tempdouble / 10.0; //Divide the value by 10 to get actual power value (as per manual)
  152.     tempdouble =  (node.getResponseBuffer(0x0005) << 16) + node.getResponseBuffer(0x0004);  //get the energy value. Energy value is consists of 2 parts (2 digits of 16 bits in front and 2 digits of 16 bits at the back) and combine them to an unsigned 32bit
  153.     PZEMEnergy = tempdouble;
  154.    // PZEMCurrent = PZEMVoltage * 0.308;
  155.     Serial.print(PZEMVoltage, 1); //Print Voltage value on Serial Monitor with 1 decimal*/
  156.     Serial.print("V   ");
  157.     Serial.print(PZEMCurrent, 5); Serial.print("A   ");
  158.     Serial.print(PZEMPower, 1); Serial.print("W  ");
  159.     Serial.print(PZEMEnergy, 0); Serial.print("Wh  ");
  160.     Serial.println();
  161.   }
  162.   else {
  163.     Serial.println("Failed to read modbus");
  164.   }
  165.   Serial.print("Volt: "); Serial.print(vr, 2); Serial.print("V, ");
  166.   Serial.print("curr: "); Serial.print(ir, 3); Serial.print("A, ");
  167.   Serial.print("pf: "); Serial.print(pf_r); Serial.println("%, ");
  168.   Serial.print("Power: "); Serial.print(power); Serial.print("W, ");
  169.   Serial.print("Energy: "); Serial.print(energy, 3); Serial.print("kWh, ");
  170.   Serial.print("freq: "); Serial.print(freq, 1); Serial.print("Hz, ");
  171.   Serial.print("Temp: "); Serial.print(t); Serial.print("C, ");
  172.   Serial.print("Humid: "); Serial.print(h); Serial.println("%, ");
  173.   Serial.println();
  174.   delay(1000);
  175. }
pls help me, thanks in advance
regards,

james