Teensy 3.2 Having Problems with MicroSD

Status
Not open for further replies.

Sakuyal

Member
Hello,

I've been doing a few tests with this TFT display from Adafruit: https://www.adafruit.com/product/3787 and have been running into problems with initializing and loading files from the included microSD slot.

It seems to happen at random. Sometimes, I can load an image to the screen fine with only a few lost pixels. Other times, the image is partially corrupted when it loads or can't be found at all. And other times still, the SD card itself fails to initialize. The only thing I'm doing between each attempt is plugging and unplugging the USB.

I know it's a Teensy problem because I wired it up on an Arduino Uno and the microSD + display have been working flawlessly. I suspect it has something to do with how fast the Teensy is compared to the Arduino, but I don't know enough to be able to fully pinpoint the problem myself.

I've attached the script I've been running to this post. The SD card I'm using is a SanDisk microSDHC formatted FAT32. I've tried everything from decreasing the buffer size to adding a delay both in this script and in the SD library to give it more time to boot up to switching libraries from SD to SdFat and so far nothing has worked. Any insight or suggestions would be appreciated!
 

Attachments

  • spitftbitmap.ino
    10.2 KB · Views: 48
There have been problems reported in the past that were solved by putting a 10K pull-up on the CS lines to hold them inactive (not floating) when the Teensy started to execute its setup(). Aparently some SD cards were getting confused during initialization of other devices. There have also been reports here of TFT displays not properly tri-stating their MISO lines when another device was attempting to use the SPI bus. Use Google to do a search of this forum for similar problems. I would recomend trying the resistors and setting all CS lines HIGH asap in your program, then proceding to initializing the TFT and SD card. You may also want to ask this question in the ADAFRUIT forum and relay their answer back here.
 
Status
Not open for further replies.
Back
Top