PDA

View Full Version : SD Card with Teensy 3.0



doctek
11-19-2012, 04:19 AM
I am having a problem getting Teensy3.0 to work with the Arduino SD Card Library. Specifically, I am trying to run Examples -> SD -> Cardinfo. I looked at earlier postings on the SD card usage on Teensy3.0. but they don't discuss the pinout in use.

I am running the Cardinfo example without modification. Looking at the Teensy3.0 pinout card, it seems like I would use Pin10 as CS, Pin11 as MOSI, Pin12 as MOSI, and Pin13 as SCK. These go to my SD card on pins 1, 2, 7, and 5 respectively. 3.3V goes to SD card pin 4, with ground on pins 3 and 6.

This seemed like the simplest thing I could try with my SD card. Where am I going astray?

t3andy
11-19-2012, 04:35 AM
Are you using SdFat library?
Also look at link
http://forum.pjrc.com/threads/540-ChibiOS-RTand-FreeRTOS-for-Teensy-3-0

doctek
11-21-2012, 04:51 AM
Are you using SdFat library?
Also look at link
http://forum.pjrc.com/threads/540-ChibiOS-RTand-FreeRTOS-for-Teensy-3-0

As I mentioned, I am doing the simplest thing I can think of. And that is not (as far as I know) using any special library - just standard Arduino stuff. I am just trying to run the example in Arduino (details above in the earlier email). Either this should work, or folks should be warned that it (and the other SD examples? ) don't work with T3. Having easily run, standard examples that don't work is frustrating.

That said, thank you for the pointer. Looks like I should try the SdFat Library and follow the discussion in the thread. I'll try to post how it goes.

doctek
11-21-2012, 05:37 AM
Followed the links to SdFat and downloaded it, and installed (following the readme in the zip).

Loaded the Example -> SdInfo and uploaded it to T3. Works like a champ!

Thanks, t3andy, thanks Bill Greiman, and of course, thanks Paul for the T3.

Paul
11-21-2012, 05:55 AM
I tried cardinfo and it works on some cards, but not others. Does listfiles work? I tested that with the default SD lib and it worked.

doctek
11-22-2012, 07:09 PM
So I had time to do some more testing today. Happy with SdFat, I decided to try the SD library again. That had not worked for me before and I wanted to know what was wrong.

Short answer: Operator Error! First, I tried listfiles from the Examples -> SD since it was mentioned in Kickstarter update #16. Worked fine! Then I went back to the Cardinfo Example. Didn't work - this is what prompted me to post in the first place. Reading the code carefully and comparing it to listfiles, I notice that chipSelect is 10 in listfiles and 4 in Cardinfo. Changing the value to 10 in Cardinfo made it work!

If you look back to my original post, I claim to have set chipSelect to 10 in Cardinfo. Apparently, I did not do that - hence the Operator Error.

Thanks, everyone for your patience. For me, I learned about SdFat library and the RTOS work. I would not have discovered that had I not messed up using the SD library.