Adafruit - THE MUSICAL - is here! Get a musical tour of Becky's favorite tools around the Adafruit factory (video) and subscribe!

1.8" TFT shield SD card not working with Arduino Due
Moderators: adafruit_support_bill, adafruit

1.8" TFT shield SD card not working with Arduino Due

by tarrat60 on Thu Oct 10, 2013 10:18 am

Hi there, I am trying to use a 1.8" TFT shield with the Arduino Due. Thanks for updating the ST7735 libraries so this is possible. I have gotten all the TFT functions to work, but I cannot seem to get any SD card functions to work. I have used the shield on an Duemilanova and all functions work, so I am confident that the hardware is OK. I have also tried formatting the SD card with the "official" SD card formatter and changing to QUARTERSPEED per another post I saw, but still with no luck. The sketch never gets past the SD card initialization. Any suggestions or ideas or tests to try? Thank you.
tarrat60
 
Posts: 7
Joined: Fri Sep 06, 2013 4:09 pm

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_bill on Thu Oct 10, 2013 1:34 pm

The Due pinout for SPI is different. You would need to use "soft-spi" to talk to the SD card.

We have a version of the SD library that supports soft-spi. Not sure if it has been tested on the Due yet. The instructions for using it are here: http://learn.adafruit.com/adafruit-data ... d-leonardo
One change for the 1.8" shield is that the CS pin for the SD card would be pin 4 instead of 10.
User avatar
adafruit_support_bill
 
Posts: 32598
Joined: Sat Feb 07, 2009 10:11 am

Re: 1.8" TFT shield SD card not working with Arduino Due

by tarrat60 on Fri Oct 11, 2013 9:04 am

Thanks for responding. It looks like this library is not set up for the Due. When I compile I get the following error:

Arduino: 1.5.4 (Windows 7), Board: "Arduino Due (Programming Port)"

In file included from C:\Users\TomR\Documents\Arduino\libraries\SD/utility/Sd2Card.h:26,
from C:\Users\TomR\Documents\Arduino\libraries\SD/utility/SdFat.h:27,
from C:\Users\TomR\Documents\Arduino\libraries\SD/SD.h:24,
from CardInfo.pde:22:
C:\Users\TomR\Documents\Arduino\libraries\SD/utility/Sd2PinMap.h:23: fatal error: avr/io.h: No such file or directory
compilation terminated.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

From some posts on the official Arduino forum it looks like some users are using the dedicated "hard-spi" (high speed) port on the due. I wonder if the timing on the Due doesn't allow a "soft-spi" solution for the SD card? The TFT seems to work fine with the "soft-spi" though.

Please let me know if there's a way to clear up these compiler errors or if you have other ideas. Thanks.
tarrat60
 
Posts: 7
Joined: Fri Sep 06, 2013 4:09 pm

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_rick on Fri Oct 11, 2013 9:29 am

The Adafruit SD library, which you are using, hasn't been ported to the Due yet. If you remove SD from your \Arduino\libraries folder, the IDE will use its own internal version, which does work with with the 1.8" TFT Shield.

Note that you don't have to permanently delete the SD library - what I did was to create an \Arduino\libraries\Adafruit_SD folder, and then I moved the SD folder inside of it. That is enough to hide it from the IDE.

The Adafruit SD library is essentially the same as the standard SD library, but it adds the ability to use soft SPI on any set of pins. The standard SD library only allows soft SPI on pins 11, 12, and 13.

adafruit_support_rick
 
Posts: 14479
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 1.8" TFT shield SD card not working with Arduino Due

by tarrat60 on Mon Oct 14, 2013 10:22 am

Thanks for all your help, but it looks like the SD card on the 1.8" TFT with the Due is not going to work. I have tried both the Adafruit SD library (errors in compiling) and the standard SD library (card fails initialization). There must be something either wrong with my particular shield (although it works fine on Duemillianova) or there is some timing/logic error that needs to be addressed in a library rewrite. Thanks again.
tarrat60
 
Posts: 7
Joined: Fri Sep 06, 2013 4:09 pm

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_rick on Mon Oct 14, 2013 11:45 am

That's odd - I had the SD working with the Due and the built-in SD library. What version of the IDE are you using? I have 1.5.4.

adafruit_support_rick
 
Posts: 14479
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 1.8" TFT shield SD card not working with Arduino Due

by tarrat60 on Mon Oct 14, 2013 1:09 pm

I'm also using 1.5.4. I have been using either the cardinfo sketch or the spitftbitmap sketch (with mods for pin changes) to try to get this to work.
tarrat60
 
Posts: 7
Joined: Fri Sep 06, 2013 4:09 pm

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_rick on Mon Oct 14, 2013 1:38 pm

Ohhhh, yeah.... :oops:
It was the breakout that I had the SD working with, not the shield. The Due SD library will only use the hardware SPI pins, which are brought out on the ICSP header. I wired it up that way for the breakout. For the shield SD to work, one of two things has to happen:
1) jumper wires from the ICSP to pins 13, 12, 11
2) I port the Adafruit SD library to the Due.

#2 is on my list of things to do, but no ETA yet... :(

adafruit_support_rick
 
Posts: 14479
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 1.8" TFT shield SD card not working with Arduino Due

by tarrat60 on Mon Oct 14, 2013 4:08 pm

That would explain it. I feel a little better now, at least I'm not feeling like I have a shield that is somehow out of spec compared to everyone else's. I'll just have to figure out if I want to do some additional wiring or go to the breakout or some other option. Thanks for sticking with this. Please let me know if/when you do the library changes if possible.
tarrat60
 
Posts: 7
Joined: Fri Sep 06, 2013 4:09 pm

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_rick on Mon Oct 14, 2013 4:39 pm

Will do

adafruit_support_rick
 
Posts: 14479
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 1.8" TFT shield SD card not working with Arduino Due

by grimsi on Thu Oct 31, 2013 10:23 am

Is it done already or are yo working on it?
grimsi
 
Posts: 5
Joined: Wed Aug 28, 2013 4:23 am

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_rick on Thu Oct 31, 2013 10:36 am

Still working on it. It's kind of ugly. Might have it ready in a week or so - that's my goal...

adafruit_support_rick
 
Posts: 14479
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 1.8" TFT shield SD card not working with Arduino Due

by grimsi on Thu Oct 31, 2013 11:09 am

That would be great :)
grimsi
 
Posts: 5
Joined: Wed Aug 28, 2013 4:23 am

Re: 1.8" TFT shield SD card not working with Arduino Due

by adafruit_support_rick on Wed Nov 06, 2013 6:07 am

OK - download and install the new Adafruit SD library (name the library folder "SD")
https://github.com/adafruit/SD

Also, there's a new soft_spitftbitmap example sketch in the Adafruit_ST7735 library:
https://github.com/adafruit/Adafruit-ST ... r/examples

The new example should run on the Due with the 1.8" TFT shield attached. Make sure you have the "parrot.bmp" file on your SD card.
http://learn.adafruit.com/system/assets ... parrot.bmp

adafruit_support_rick
 
Posts: 14479
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY