9 years, 3 months ago.

SD Card Use

Hi,

Whenever I enable the SD Card function all the TFT.xxxx functions error out that they are inaccessible.

If I don't enable it and setup the SD Card object myself, so far I get error 0 loading graphic from SD card.

Any ideas?

Question relating to:

Library for SeeedStudioTFTv2 2.8 Zoll 240x360 pixel touch SD card display, Seeedstudio, TFT

1 Answer

9 years, 3 months ago.

Do you use the same SPI port ? Which platform ?

Accepted Answer

Yes, I am using the SeeedStudioTFTv2 with the SD card on the same bus. This is on the Arch Pro.

I sometimes can get it to write to the SD card on a test program. Seems flaky though. Seems like there isn't a good SD card library. I am using a 4GB SD card that I use for all my embedded hardware testing.

posted by William Garrido 21 Jan 2015

If you want to use the SD Card and the TFT on the same SPI you have to ensure that the commands are blocked. If you try to read out a graphic from SD this will intercept the actual TFT command. TFT : Command , Data , Data ... The SPI has to be active until all pixels are send to the TFT.

You have to use a different SPI or you can try to buffer the graphic fist.

posted by Peter Drescher 21 Jan 2015

Thanks. Then why is the library setup to create a SD object within the SeeedStudioTFTv2 library, using the same SPI pins? I can't really change the hardware in this case.

I thought that is what the Slave select pin was for?

Hmm I have it working on the Arduino using their examples.

posted by William Garrido 21 Jan 2015

The author of the SeeedStudioTFTv2 library has used my libs, but this will not work for reading a graphic from SD card on the same bus ! You need additional code to buffer the whole graphic in ram, or to read a smaller block and send it to the TFT. The demo is only using the display, not the SD card ! There are only 6 imports of this lib... With the slave select only one SPI slave is selected, but both TFT and SD card are handling complex data transfers, which have to be finished before switching off the select. My lib is reading one line of the graphic and send it to the TFT. This call of SD card read inside the function will select the SD card, but will not deselect the TFT :-( bang . If you deselect the TFT you also stop the TFT command.

It is possible to make this function working, but you will need a different implementation.

posted by Peter Drescher 21 Jan 2015