MMC/SD question.

Hello all,

I have built up an ATmega32 and an SD card socket. The SD card is a Lexar Media 32MB card.

I have been following many souce code examples on how to read this SD card.

I have been able to read the CID and the CSD registers, and it seems to be reading correctly.

When I try to read a sector ( 0000 ) I wait for a "start data token"

0xfe, but it never comes.

The psudo-code is:

lower CS, send 6 bytes of CMD17,0x00,0x00,0x00,0x00,0x95, wait for a response. ( anything not 0xff) raise CS (check for response = 0x00) lower CS again and wait for the data token (0xfe)

( send 0xff as a wait for token )

It times out waiting for the 0xfe.

I tried to not raise and lower CS in-between the CMD17 and waiting for the data token, but same result.

Any ideas why I do not see the data token ???

Thanks

Donald

Reply to
Donald
Loading thread data ...

Donald scrobe on the papyrus:

Hi Donald,

If you have connected the card CS to to the slave select pin (#SS) of the SPI it will not work. Raising and lowering the #SS pin on the Atmel SPI module, causes it to drop in and out of master mode. You must use a different pin on the ATmega32.

HTH.

--
John B
Reply to
John B

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.