itdb02 sd card : unable to do working

Hello all,

That's my first post but before asking, I've lost many long hours to search.

I'am working with an arduino Mega with an itdb02 lcd and touch (buy on ebay chinese seller).
using 1.01 version of shield.

on the lcd board there is a sd card reader.

here are some picture of the lcd+sd card and tft lcd mega shield

I've checked allthe wiring here are my check results :

SS - mega pin 53 - shield pin 38 - SD_CS - pin 1 SD
MOSI - mega pin 52 - shield pin 37 - SD_DIN - pin2 SD
SCK - mega pin 51 - shield pin 36 - SD_SCK - pin5 SD
MISO - mega pin 50 - shield pin 35 - SD_OUT - pin 7 SD

with two resisor of 1k so 1.9 K on signal but not on MISO.

I have tested all the library available that I found : sdfat, tinyFat,sd sparkfun
but unsucessfully ...

for example using software SPI with sdfat modifying sdfatconfig.h

/**

  • Set USE_SOFTWARE_SPI nonzero to always use software SPI.
    /
    #define USE_SOFTWARE_SPI 1
    // define software SPI pins so Mega can use unmodified 168/328 shields
    /
    * Default Software SPI chip select pin /
    uint8_t const SOFT_SPI_CS_PIN = 53;
    /
    * Software SPI Master Out Slave In pin /
    uint8_t const SOFT_SPI_MOSI_PIN = 52;
    /
    * Software SPI Master In Slave Out pin /
    uint8_t const SOFT_SPI_MISO_PIN = 50;
    /
    * Software SPI Clock pin */
    uint8_t const SOFT_SPI_SCK_PIN = 51;
    #endif // SdFatConfig_h

do not work.

my sd card is fat 16 formatted

what should I do ?

Why are you using software SPI on the hardware SPI pins?

because it seems that on mega the spi pin are different than the wiring of these chinese shield.

chinese shield
SS - mega pin 53
MOSI - mega pin 52
SCK - mega pin 51
MISO - mega pin 50

mega
this is 50 (MISO), 51 (MOSI), 52 (SCK), and 53 (SS). MISO, MOSI

I suppose the chineses do an error between sck and mosi ?

If it's anything like the sainsmart board that i've been getting to work properly, at the every least you'll need to swap SCK and I think MOSI.

I had another problem where CS looked rather like bart simpsons hair, so I put in a 74HC4050 and now it all works at full speed.

because it seems that on mega the spi pin are different than the wiring of these chinese shield.

The point is that the hardware SPI pins can not be used for software SPI, any more than the hardware serial pins can be used for software serial.

ok understood .. that's why so long hours lost ...

so the last solution is to hard wiring .

tks guys ! I 'll try.

even with a switch between SCK and MOSI it does not work correclty .. I'am really lost

Next thing to look at might be the waveform at the card socket, not sure exactly when I took the screenshot, it was either on the fresh board with a 10k in series, or with a divider, which ever it was the Arduino was clocking out data nicely, but the signal at the card was garbage.

Running SPI at slow speeds (/128) might just get it talking.

yep I confirm the 10k resistor one on the shield and one on the lcd sd card.

So it give 20k .... will check if there is a divider but seems in my last check it was a direct connection.

thks beige and puals,

in fact there was 2 problems on this shield and one problem on my 2 old SD card.

  • the lcd and the shield give 10K+10k on MOSI SCK SS and MISO.
  • the SCK and MOSI was switched on wire.

so I have modified the wiring like this :

and now it is okay at 8mhz...
so be carrefull on this shield+lcd, th sd card it is not compatible with arduino as it comes !

one last question :
my old 16Mb SD and micro SD 128Mb + SD adapter do not work ...
but my 32Go is okay.

so old SD do not support spi access ?

Most likely your 16MB card is formatted FAT12.

You can force it to be FAT16 by using the SdFat SdFormatter example located in SdFat/examples/SdFormatter.

All SD cards support SPI. If your 16MB card is an MMC card, it won't be supported by SdFat or the Arduino SD.h library.

I've treid the format example.

Enter 'Y' to continue: Y

Options are:
E - erase the card and skip formatting.
F - erase and then format the card. (recommended)
Q - quick format the card without erase.

Enter option: F
error: cardSize
SD error: f,fc

and the SD formtter 3.1 say not supported ....
but it is possible to use it on windows.
really strange...

The card does not return a valid response to a read. It must not be a true SD card.

SDFormatter 3.1 also rejects it so it won't work in some SD devices.

Windows accepts cards released before the official SD spec and MMC cards.

I didn't add code for these cards to the Arduino libraries since it would increase the size of the libraries and these old cards are now rarely used.

you are right these are old Sd card.

Thks for explanation :slight_smile:

hello
I have the same problem.
is it possible to have a photo of the modification?
because I do not understand the schematic.
thank you for your reading.