5
\$\begingroup\$

I am working on an NEC v850ES/JH3 controller for testing an SD card driver in SPI mode. We interfaced the SD card slot directly to the v850ES/JH3 controller without any pull-up resistors. Does it have any negative effects?

  1. I am able to initialize the SD card in SPI mode. I am also getting a 0x00 response for CMD16.

  2. After SD card initialization I am changing the clock frequency to 4 MHz.

  3. I am checking SD card busy or not (if the response is 0xFF then the SD card is not busy).

  4. When I am sending a read command (CMD17) and dummy data, I get the response 0xC1, and after that, the next byte is 0x3F. That means the read command failed.

  5. If we don't send dummy data after the read command then I am getting response 0x04, meaning an illegal command. In this case also, read is failing.

  6. If we won't check the SD card is busy or not then I am getting response 0x00 for the read command, which means the read command was accepted. And I am also getting the start token (0xFE), meaning the SD card will send a block of data. If I read 512 bytes of block data then I am getting all zeros. I am trying to read the boot record. That means some data is there other than zeros.

  7. I am also facing the same issue with SD card block write.

What is the problem and how can I fix it?

Peter Mortensen
1,6973 gold badges17 silver badges23 bronze badges
asked Feb 14, 2011 at 12:19
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

The "checkbusy" must send 0xFF to the SD card (that is not clear in your question). Is this SD or SDHC? The latter have some differences in initialization and operation sequences.

If we don't send dummy data after read ...

In SPI, you have to send data to be able to read from the client. Remember that the master always drives the clock line. The dummy data I send when reading SD cards is 0xFF, too.

The 512 zero bytes may be actual data from the device. Are you sure that you sent the address bytes in the correct order? The SD Simplified Specifications are available from the SD Association.

PeterJ
17.3k37 gold badges58 silver badges91 bronze badges
answered Apr 27, 2011 at 17:05
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.