I am working on a project to monitor battery status in my electric car (converted 1968 MGB) ... I am a Mac user, my first attempt was to use an arduino ZERO, it worked OK but I needed more I/0 capability, so I switched to a teensy 3.2 ... the teensy 3.2 is a perfect fit ...the two I2C connections made life much easier (they work perfectly!) ... so far everything (sensors, displays, switches) is working well with one exception: I am using a micro SD card (Adafruit MicroSD card breakout board ID:254) to log usage data ... the SD card worked well on the ZERO but I can't get the Teensy to recognize the SD ... I keep getting the standard "initialization failed" situation ...
the SD card board is already buried in the project with dozens of wires connecting various components, so a picture of the hardware would not be helpful ... I double checked the wiring: CLK to pin 13, DO to pin 12, DI to pin 11 CS to pin 10.
the sketch for the test routine follows:
/*
SD card read
*/
//#include <Wire.h>
#include <i2c_t3.h>
#include <SD.h>
#include <SPI.h>
#include <BMS_simple.h> // this for the full application, and not really used for the test
File LogFile;
byte buffer[100];
int indx;
void setup()
{
delay(9999);
while(!Serial);
Serial.begin(115200);
Serial.print("About to initialize SD ");
pinMode(10, OUTPUT); // 10 is chip select for SD card
if(!SD.begin(10))Serial.println("initialization failed!"); delay(999);
if(!SD.begin(10)){Serial.println("initialization failed!"); return;}
Serial.println("initialization done.");
LogFile = SD.open("Log_File.dat", FILE_READ); // Re-open file for reading
if (LogFile)
{
Serial.println("Read Log record zero.");
while (LogFile.available())
{
Serial.print(LogFile.read());
delay(99);
}
LogFile.close();
}
else Serial.println("Error opening Log record ");
}
void loop()
{
exit(0);
}
.......... any suggestion would be much appreciated.
the SD card board is already buried in the project with dozens of wires connecting various components, so a picture of the hardware would not be helpful ... I double checked the wiring: CLK to pin 13, DO to pin 12, DI to pin 11 CS to pin 10.
the sketch for the test routine follows:
/*
SD card read
*/
//#include <Wire.h>
#include <i2c_t3.h>
#include <SD.h>
#include <SPI.h>
#include <BMS_simple.h> // this for the full application, and not really used for the test
File LogFile;
byte buffer[100];
int indx;
void setup()
{
delay(9999);
while(!Serial);
Serial.begin(115200);
Serial.print("About to initialize SD ");
pinMode(10, OUTPUT); // 10 is chip select for SD card
if(!SD.begin(10))Serial.println("initialization failed!"); delay(999);
if(!SD.begin(10)){Serial.println("initialization failed!"); return;}
Serial.println("initialization done.");
LogFile = SD.open("Log_File.dat", FILE_READ); // Re-open file for reading
if (LogFile)
{
Serial.println("Read Log record zero.");
while (LogFile.available())
{
Serial.print(LogFile.read());
delay(99);
}
LogFile.close();
}
else Serial.println("Error opening Log record ");
}
void loop()
{
exit(0);
}
.......... any suggestion would be much appreciated.