The CAN-BUS shield (by linksprite) work well with arduino UNO. However, when I use an arduino MEGA 2560 , it shows the CAN cannot be initialized. Like the connection method shown in website “Matthew McMillan: Using the Seeed CAN-BUS shield with an Arduino Mega”. I bent the 11,12,13 pins of shield, and used three jumper wires to connect the SPI pins between the shield and MEGA, that is 50(mega)-12(shield), 51(mega)-11(shield), 52(mega)-13(shield). Pin 10 was still as CS pin. After upload, it shows the function, “CAN.begin(CAN_500KBPS)” was not success. In the print window it shows CAN bus shield init failed. Which codes should be changed?
My codes are listed as following:
const int SPI_CS_PIN = 10;
while (CAN_OK != CAN.begin(CAN_500KBPS)) // init can bus : baudrate = 500k
Serial.println(“CAN BUS Shield init fail”);
Serial.println(" Init CAN BUS Shield again");
Serial.println(“CAN BUS Shield init ok!”);