I have been working trying to get an A0 to run a project I am currently working on. I have used the M2 for the project, but do not need the extra inputs that the M2 offers. With that being said, I am hitting a roadblock. Essentially, the can never shows available nor does it receive any incoming messages. I have looked everywhere for help on the A0 and have come up short. I am attaching my simplified code below. In the IDE I am setting it as the ESP32 Dev Module. It compiles with no problem. However, it never appears to enter the can0.available area. I have commented that out and asked it to only output the Can0.read(incoming) and it still would never output anything but 0 for the incoming.id. I have a can logger on and have ensured I am getting plenty of traffic over the bus. The speed is for sure 500k also. I have also tried adding the watchfor command and setting up mailboxes. None of this is needed for the M2. So, I am a little confused. Any help would be appreciated.
#include <esp32_can.h>
CAN_FRAME incoming;
CAN_FRAME outgoing;
void setup() {
delay (1000);
Serial.begin(115200);
Serial.flush();
Can0.begin (CAN_BPS_500K);
delay(1000);
}
void loop() {
if (Can0.available() > 0) {
Serial.println("Can Available");
Can0.read(incoming);
Serial.println(incoming.id);
}
}