Hi everybody
I found that interrupts() and noInterrupts() functions called in a library code causes med crashs (red line lighting).
I made investigations and I'm sure these functions in this library causes crash.
How shall I solve this ?
Thanks !
Hi everybody
I found that interrupts() and noInterrupts() functions called in a library code causes med crashs (red line lighting).
I made investigations and I'm sure these functions in this library causes crash.
How shall I solve this ?
Thanks !
Which library ?
But I'm sure it's not due to the library, very well written and working like a charm on others of my projects.
Best regards
The library has been adapted for the ESP32 (FreeRTOS).
Here are a few notes about the interrupts() and noInterrupts() causes the ESP32 to crash: https://github.com/pierremolinaro/acan2517FD/blob/master/src/ACAN2517FD.cpp#L18
You have the same situation in my opinion. I think that the library is not yet compatible with the Giga R1.
Thank you for your answer.
This library supports severall platform and boards as Arduino, Teensy, etc, not only ESP32.
This library is supposed to work with any uC with SPI connection.
As interrupts() and noInterrupts() are supposed to work with Giga, I don't understand.
Best regards
Me neither, but without the special code for the ESP32, it crashes the ESP32.
You can test it briefly by upload the blink code with interrupts() and noInterrupts() functions added.
Please let us know about results.
The issue is not the library.
Please check this simple code. Mbed crashes with it, while it runs fine if you delete the SPI.transfer line.
#include <SPI.h>
const int CS_1 = 7;
void setup() {
pinMode(CS_1, OUTPUT);
Serial.println(" START");
SPI.begin();
digitalWrite(CS_1, LOW);
noInterrupts();
SPI.transfer(0x00);
interrupts();
digitalWrite(CS_1, HIGH);
Serial.println(" END");
}
That is not a complete sketch. I had to add an empty loop: void loop() {}.
Please be clear what you do, you can mention that you wrote about it here: https://github.com/pierremolinaro/acan2517FD/issues/41#issuecomment-1974078718
In Wokwi simulation on a Raspberry Pi Pico (Arduino with Mbed) it crashes also on the SPI.transfer:
++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x2000A7B4, Not allowed in ISR context
I have seen similar things with attachInterrupt() and detachInterrupt() on other boards.
This seems a similar problem: Possible BUG: noInterrupts() followed by analogRead()
But I can still not read that it will be fixed.
I'm sorry, I still don't know how to fix it.
SPI.transfer, probably, needs an interrupt to work. So is not surprisingly that it crashed in that case.