Open ElektroBOXua opened 1 year ago
Oh, i have found a solution for the issue by replacing:
#ifdef ARDUINO_ARCH_ESP32
void ACAN2515::attachMCP2515InterruptPin (void) {
attachInterrupt (digitalPinToInterrupt (mINT), mInterruptServiceRoutine, ONLOW) ;
}
#endif
to
#ifdef ARDUINO_ARCH_ESP32
void ACAN2515::attachMCP2515InterruptPin (void) {
if (mINT != 255) {
attachInterrupt (digitalPinToInterrupt (mINT), mInterruptServiceRoutine, ONLOW) ;
}
}
#endif
Also i've noticed that there's a poll function, which is actually what i've needed. Issue can be closed.
When there are no IRQ pin specified, acan2515 requires inInterruptServiceRoutine to be NULL
There is no check for mINT != 255 thus this task is still created
It also seems that 1024 is not enough stack size for the task on my esp32 because i've got stack cannary watchpoint triggered before noticing the main issue(Probably stack overflow).
After i fixed the problem it appeared that attachMCP2515InterruptPin attaches NULL to -1 pin which causes crash.
I tried to remove iterrupt task at all, but then i noticed that there are no mechanisms to poll messages, so it would not work anyway.
I didn't look more throught the code, so i am curious how to use this library without an IRQ pin on ESP32?