I need to used Vext to turn a sensor on and off. I created a very simple sketch (below) to test using Vext. It crashes with an unhandled exception the second time Vext is turned on. It does this every time and on two different boards. Is there a workaround or fix to this?
int statusEC=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(21,OUTPUT);
delay(3000);
Serial.println(“power on EC”);
digitalWrite(21,LOW);
statusEC=1;
}
void loop() {
// put your main code here, to run repeatedly:
if(statusEC == 0)
{ Serial.println("turing ON EC"); digitalWrite(21,LOW); statusEC=1; } else { Serial.println("turining off EC"); digitalWrite(21,HIGH); statusEC=0; } delay(5000);
}
The output, error & backtrace are:
12:44:03.577 -> power on EC
12:44:03.577 -> turining off EC
12:44:08.568 -> turing ON EC
12:44:08.568 -> Guru Meditation Error: Core 0 panic’ed (IllegalInstruction). Exception was unhandled.
12:44:08.568 -> Memory dump at 0x400e0dac: 09dad29e f6cdc200 090c1e0c
12:44:08.568 -> Core 0 register dump:
12:44:08.568 -> PC : 0x400e0db0 PS : 0x00060031 A0 : 0x40083864 A1 : 0x3ffbe520
12:44:08.568 -> A2 : 0xfffffbc1 A3 : 0x00000000 A4 : 0x800e12c6 A5 : 0x40088318
12:44:08.600 -> A6 : 0x00000000 A7 : 0x40083240 A8 : 0x800e2d25 A9 : 0x3ffbba70
12:44:08.600 -> A10 : 0x3f4052b4 A11 : 0x3ffbbe20 A12 : 0x800e12bb A13 : 0x3f405bb4
12:44:08.600 -> A14 : 0x00000019 A15 : 0x3ffbc10f SAR : 0x0000001f EXCCAUSE: 0x00000000
12:44:08.600 -> EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
12:44:08.600 -> Core 0 was running in ISR context:
12:44:08.644 -> EPC1 : 0x400e0db0 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x00000000
12:44:08.644 ->
12:44:08.644 -> ELF file SHA256: 0000000000000000
12:44:08.644 ->
12:44:08.644 -> Backtrace: 0x400e0db0:0x3ffbe520 0x40083861:0x3ffbe540 0x400e91ef:0x3ffbc130 0x400e15cf:0x3ffbc150 0x400875ea:0x3ffbc170 0x40086155:0x3ffbc190
12:44:08.644 ->
12:44:08.644 -> Rebooting…