NO LOOPBACK IN LIBRARY WITH CALLBACK EXAMPLE WITH ESP32
- always shows Guru Meditation Error: Core 1 panic'ed when trying to send CAN MESSAGE inside the onReceive function### ``(InstrFetchProhibited).
here is the onReceive method:
void onReceive(int packetSize)
{
long CAN_ID;
int cmd_time_gateway[8];
uint8_t count = 0;
// received a packet
Serial.print("Received ");
Serial.print("packet with id : 0x");
//// (11 Bits Messsage ID) 2 bits MSG CMD + 9 bits CAN ID.
CAN_ID = CAN.packetId();
CAN_ID &= 0x1FF;
Serial.print(CAN_ID, HEX);
Serial.print(" = ");
Serial.print(CAN_ID);
Serial.print(" and length ");
Serial.println(packetSize);
// only print packet data for non-RTR packets
while (CAN.available())
{
// (8 Bytes data) 1 byte CMD 4 bytes timestamp 3 bytes Gateway.
cmd_time_gateway[count] = CAN.read();
Serial.print(cmd_time_gateway[count], HEX);
count++;
}
switch (cmd_time_gateway[0])
{
case 0xFF:
/* code for send own id (response of request all id) */
Serial.println(" - SEND REQUEST ALL ID RESPONSE(SEND OWN ID)");
confirmSpecificNewID(CAN_ID);
Serial.println(" - CAN ID CONFIRMED)");
break;
case 0xF0:
/* code for confirmation of ID from rfid node */
Serial.println(" - send confirmation request");
break;
case 0x0F:
/* code for heartbeat */
Serial.println(" - HEART BEAT");
break;
default:
/* code for detection of RFID module */
Serial.println(" - CARD DETECTION");
break;
}
Serial.println(" - ENDED");
}
after finishing the onReceive function and execute this
void confirmSpecificNewID(long confirmedID)
{
int id = confirmedID | 0x200;
CAN.beginPacket(id, 8);
CAN.write(confirmSpecificIDBuffer, 8);
CAN.endPacket();
}
Take in note that nothing happens it just works brilliantly if i removed confirmSpecificNewID() which for me that onReceive unable to operate functions inside ??
i am also getting the same error.
In my Loop() I need to send some Can data to recive it in the callback. I made some tests and if i Isolate the Can bus readings into a New Task, without the callback function it works (slowly...). & I need the speed...
But for now, This is my Error that I get:
rst:0xc (SW_CPU_RESET),boot:0x17 (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:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4
Guru Meditation Error: Core 1 panic'ed (Coprocessor exception)
Core 1 register dump:
PC : 0x400d1adb PS : 0x00060031 A0 : 0x800d7bb8 A1 : 0x3ffbe9b0
A2 : 0x3ffc55b4 A3 : 0x00000001 A4 : 0x80093912 A5 : 0x00000000
A6 : 0x00000001 A7 : 0x3ffbaca0 A8 : 0x00000000 A9 : 0x000b4103
A10 : 0x000007e8 A11 : 0x000000fd A12 : 0x0ffdac00 A13 : 0x0000abab
A14 : 0x3ffb9a30 A15 : 0x00000000 SAR : 0x00000019 EXCCAUSE: 0x00000004
EXCVADDR: 0x00000000 LBEG : 0x400df614 LEND : 0x400df676 LCOUNT : 0x00000003
Core 1 was running in ISR context:
EPC1 : 0x400d1adb EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40082941
Backtrace: 0x400d1adb:0x3ffbe9b0 0x400d7bb5:0x3ffbea90 0x400d7bc1:0x3ffbeab0 0x40081819:0x3ffbead0 0x4000bfed:0x00000000
Rebooting...