I’m trying to use a microSD card with CAN-BUS shield V2
I’ve tried formatting it several ways, all using FAT32
I’m running the example program recv_sd and using pin 4 as SPI_CS_SD
Here are the relevant lines of code and the error message from the SD initialization failing.
Any ideas of what could be going wrong?
Thanks
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_CAN = 9;
const int SPI_CS_SD = 4;
MCP_CAN CAN(SPI_CS_CAN); // Set CS pin
void setup() {
SERIAL.begin(115200);
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");
delay(100);
}
SERIAL.println("CAN BUS Shield init ok!");
attachInterrupt(0, MCP2515_ISR, FALLING); // start interrupt
if (!SD.begin(SPI_CS_SD)) {
SERIAL.println("SD initialization failed!");
while (1);
}
Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
CAN BUS Shield init ok!
SD initialization failed!
Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
CAN BUS Shield init ok!
Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
CAN BUS Shield init ok!
SD initialization failed!