Unable to use catalex MicroSD card adapter with teensy 3.2.

Status
Not open for further replies.

Suyash

New member
Hello. I am using Teensy 3.2 for my final paper and I need some memory, where I could store analog data, captured using analog output type acccelerometer through Teensy. For that, I purchased one Catalex MicroSD card adapter (Link of product is here: http://www.amazon.in/Core-Technolog...scsubtag=83bd8cdd-b0ae-4e66-928b-d102a2c77bd2). It has a slot to hold microSD card and has six pins to be connected (VCC, ground, CS, SCK, MOSI and MISO). While I am able to run it perfectly using Arduino, but the same code that I used with Arduino(and some modifications) when uploaded on Teensy and the MicroSD adapter connected to Teensy, it is displaying the message that that the card could not be initialized.
I have connected Teensy with the adapter in the following way:
VCC: teensy 5V
GND: teensy Ground
SCK: PIN 13
MOSI: PIN 11
MISO: PIN 12
CS: PIN 10
I have attached a photograph of the setup, though not very clear.

The code which worked fine with Arduino but not with Teensy is the following:

#include "SD.h";
#include <SPI.h>
const int chipSelect = 10;

void setup()
{

// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}


Serial.print("Initializing SD card...");

// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
return;
}
Serial.println("card initialized.");
}

void loop()
{}

Finally, to do some modifications in the code , I downloaded and installed SDFat library, as suggested here(https://github.com/greiman/SdFat), however I got no success.
Please someone suggest me what should I do so that I could run the adapter using Teensy 3.2. I specifically want to use Teensy 3.2 and not Teensy 3.6 as the former requires lesser area space. Thanks. image.jpg
 
Last edited:
That SD adaptor looks like it tries to make 3.3V for the card. First, use a voltmeter to (carefully) check is really is making 3.3V power for the card. Be careful not to short 5V to the card!

It has a buffer chip, but I can't see any info about what chip is actually used. Before people have found some chips are too slow. Teensy's SPI can run much faster than regular Arduino.

The simplest thing to try first is running Teensy at only 24 MHz. Use Tools > CPU Speed, and then upload. It will only be able to use 12 MHz SPI in this mode. This is still faster than normal Arduino (8 MHz max SPI), but if it works, then you at least know speed is the issue.

Internally, the SD library has code to configure the SPI speed. But it's difficult to access, using the Sd2Card object which isn't easily available from the normal Arduino functions.
 
Bill's SdFat library also has ways to configure the SPI clock speed. It is probably also using a 24 MHz default, which works fine for direct connection to the SD card or through good quality adaptors with fast chips. Maybe you can find a SdFat function to configure 4 or 8 MHz SPI clock speed?
 
Thank you. Reducing speed to 24MHz worked! I have one more question.
Can you also suggest me if I can make it work at 96MHz with the same card, as I need to sample data at highest possible rate, or I should probably change my microSD card adapter? What all parameters should I take care of while choosing my microSD card adapter?
 
if you are running with SdFat lib, with T3.2 @96MHz, try sd.begin(chipSelect,SD_SCK_MHZ(8)); to run the SPI at 8mhz
 
or I should probably change my microSD card adapter?

Yes, get a better adaptor. The chip on that cheap adaptor is too slow.

You do not need a chip between the SD card and Teensy 3.2, because Teensy uses 3.3V signals. Get one that just connects the pins directly without any chip in the signal path.
 
Status
Not open for further replies.
Back
Top