• Hiya,

    I have this simple piece of code:

    console.log('HELLO');
    console.log(process.memory());
    
    pinMode(D16, 'input_pullup');
    pinMode(D17, 'input_pullup');
    pinMode(D18, 'input_pullup');
    pinMode(D19, 'input_pullup');
    
    console.log(process.memory());
    
    const options = {
      repeat: true,
      debounce: 100
    };
    
    setWatch(e => {
      //{state:bool, time:float, lastTime:float}
      const state = e.state;
      console.log('D16 -> state:', state);
      console.log(process.memory());
    }, D16, options);
    
    setWatch(e => {
      //{state:bool, time:float, lastTime:float}
      const state = e.state;
      console.log('D17 -> state:', state);
      console.log(process.memory());
    }, D17, options);
    
    setWatch(e => {
      //{state:bool, time:float, lastTime:float}
      const state = e.state;
      console.log('D18 -> state:', state);
      console.log(process.memory());
    }, D18, options);
    
    setWatch(e => {
      //{state:bool, time:float, lastTime:float}
      const state = e.state;
      console.log('D19 -> state:', state);
      console.log(process.memory());
    }, D19, options);
    
    

    Randomly when one of the buttons is pressed I get this error:

    >Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
    Core 0 register dump:
    PC      : 0x40096496  PS      : 0x00060c33  A0      : 0x80095952  A1      : 0x3ffb7590
    A2      : 0x800888c3  A3      : 0x0000cdcd  A4      : 0x00060c20  A5      : 0x00000001
    A6      : 0xb33fffff  A7      : 0x00000000  A8      : 0x0000abab  A9      : 0x0000cdcd
    A10     : 0x00000003  A11     : 0x00060c23  A12     : 0x00060c20  A13     : 0x00000000
    A14     : 0x3ffb63ec  A15     : 0x3ffb9a20  SAR     : 0x00000000  EXCCAUSE: 0x0000001d
    EXCVADDR: 0x800888c3  LBEG    : 0x400924b4  LEND    : 0x400924d0  LCOUNT  : 0xffffffff
    ELF file SHA256: 0000000000000000
    Backtrace: 0x40096493:0x3ffb7590 0x4009594f:0x3ffb75c0 0x400d0a4a:0x3ffb7600 0x400859b6:0x3ffb7620 0x400e744b:0x3ffb7650 0x400d4a35:0x3ffb7670 0x400d0bf0:0x3ffb7690
    Rebooting...
    ets Jun  8 2016 00:22:57
    rst:0xc (SW_CPU_RESET),boot:0x13 (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:2
    load:0x3fff0018,len:4
    load:0x3fff001c,len:2984
    load:0x40078000,len:10700
    load:0x40080400,len:5236
    entry 0x40080658
    E (561) psram: PSRAM ID read error: 0xffffffff
    E (561) spiram: SPI RAM enabled but initialization failed. Bailing out.
    E (562) spiram: SPI RAM not initialized
    Guru Meditation Error: Core  0 panic'ed (IllegalInstruction). Exception was unhandled.
    Memory dump at 0x400889a4: 782c7420 1dc1b827 000000f0
    Core 0 register dump:
    PC      : 0x400889ab  PS      : 0x00060130  A0      : 0x000002a3  A1      : 0x3ffbe850
    A2      : 0x00000028  A3      : 0x00020000  A4      : 0x00000000  A5      : 0x400978b4
    A6      : 0x000c1aa3  A7      : 0x00000000  A8      : 0x00000027  A9      : 0x00000000
    A10     : 0x00000027  A11     : 0x00000040  A12     : 0x00000012  A13     : 0xc1aa0000
    A14     : 0xf4240000  A15     : 0x0000a890  SAR     : 0x0000000c  EXCCAUSE: 0x00000000
    EXCVADDR: 0x00000000  LBEG    : 0x4009ae9c  LEND    : 0x4009aea7  LCOUNT  : 0x00000000
    Core 0 was running in ISR context:
    EPC1    : 0x400889ab  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x00000000
    ELF file SHA256: 0000000000000000
    Backtrace: 0x400889a8:0x3ffbe850 0x000002a0:0x3ffbe870 |<-CORRUPTED
    Rebooting...
    

    And it just goes into a loop and keeps printing this out. Using this Firmware: espruino_2v18_esp32

    Any ideas?

  • If i change the code to this:

    setInterval( () => {
      if(digitalRead(D16) == 0) {
        console.log('D16');
      }
      if(digitalRead(D17) == 0) {
        console.log('D17');
      }
      if(digitalRead(D18) == 0) {
        console.log('D18');
      }
      if(digitalRead(D19) == 0) {
        console.log('D19');
      }
    }, 100);
    

    The error goes away

  • I'm having the exact same problem - using setWatch on the ESP32 sometimes reboots when one of the buttons is pressed.

    I think this is something to do with how GPIO interrupts the handled by gpio_intr_handler (in jshardware.c) - the code does not disable further interrupts and might be invoked again while processing (buttons generate a lot of interrupts when switching from one state to another, this is why debouncing is needed).

  • Seems like there is an open issue for this:
    https://github.com/espruino/Espruino/issues/2342

  • I'm experiencing the same problem that we've encountered in the past.

    Guru Meditation Error: Core 0 panic'ed (LoadStoreError). Exception was unhandled.
    Core 0 register dump:
    PC : 0x40096496 PS : 0x00060033 A0 : 0x80095afc A1 : 0x3ffbed30
    A2 : 0x40086144 A3 : 0x0000cdcd A4 : 0x00060023 A5 : 0x00000001
    A6 : 0xb33fffff A7 : 0x00000036 A8 : 0x0000abab A9 : 0x0000cdcd
    A10 : 0x00000002 A11 : 0x3ffea490 A12 : 0x00000000 A13 : 0x3ffea480
    A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000012 EXCCAUSE: 0x00000003
    EXCVADDR: 0x40086144 LBEG : 0x400924b4 LEND : 0x400924d0 LCOUNT : 0x00000000
    Core 0 was running in ISR context:
    EPC1 : 0x40096496 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x00000000
    ELF file SHA256: 0000000000000000
    Backtrace: 0x40096493:0x3ffbed30 0x40095af9:0x3ffbed60 0x400819a6:0x3ffbed90 0x4008593a:0x3ffbedb0 0x40085835:0x3ffbede0 0x40085d29:0x3ffbee00 0x400860f5:0x3ffbee30 0x40126507:0x3ffea460 0x40134634:0x3ffea480

  • if you have the .elf file you can use use

    https://maximeborges.github.io/esp-stackĀ­trace-decoder/

    upload .elf file and enter the Stack trace CPU wise to get detail about the function

  • I finally solved this problem by using an external pull-up resistor at the physical level, and the software should be written like this.

     setWatch(callback, pin, {
            edge: (-1),
            repeat: true,
            debounce: 50
      });
    
  • You might actually find that using a 'cutting edge' build (or 2v24 when released) fixes this as well, as I pushed a change for ESP32 2 weeks ago: https://github.com/espruino/Espruino/commit/e4937494db42b1c3e94d2fa8f1b80f033b053f73

  • @Gordon It's truly wonderful, and I sincerely appreciate your kindness.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Core 0 panic'ed Error when pressing buttons attached to GPIO PINS

Posted by Avatar for Ivan @Ivan

Actions