I am building some circuit that will adapt some pumps in a car according to the car real-time parameters values. I need to talk to the car through OBDII. I have a MEGA 2560 and OBDII to DB9 cable in addition to a CAN shield (Arduino MKR CAN Shield — Arduino Official Store).
I did not notice that it is supposed to be a shield for an MKR board before buying it, anyways, I tried to look up for the corresponding pins on the MEGA for MOSI, MISO, SCK, etc.
So, I did the connections, but it does not pull data. I assume there is a problem with the compatibility of the library with the MEGA, so is it a good idea to dig into the library source and tweak some lines to have the MEGA working fine? or it will be very nasty/impossible. If you have any advice for the wise step to take, please let me know.
P.S. I am not very familiar with the differences between MEGA/MKR except the different peripherals availability/distribution.
maybe this is not answering your question related to Arduino MKR CAN Shield and Mega 2560.
But I got crazy with a MKR CAN Shield + Arduino MKR Wifi1010 and I manage to SEND OUT can messages FROM MKR CAN Shield running the sandeepmistry library ONLY when I set up the transmission speed to 250 Kbps.
void setup() {
// start the CAN bus at 250kbps which is OK for MKR CAN SHIELD
if (!CAN.begin(250E3)) {
Serial.println("Starting CAN failed!");
while (1);
}
}
Not sure this will be working in your case as well, but maybe it is worth a try.
Take care,