1
\$\begingroup\$

I have a problem for which I can't find the solution in previous topics.

I'm using a microcontroller to read data from a Kodak 2GB Micro SD Card. I want to write a minimal driver in SPI mode, no need to do writing or formatting operations, just read some files.

I can see those signals on a 4 channel scope: CS, MOSI, MISO, CLK.

I do the following:

  1. I send 100 bytes at 100KHz, with MOSI and CS high.

  2. I send CMD 1, no argument, response type R1 returns 0x1, correct.

  3. I send CMD 8, arg=0x1AA, response type R7 returns 0x1+ arg 0x1AA, correct.

  4. At this point every command returns 0x5 at the 4th byte of the command. In other words, before the 6 bytes command is completely issued.

Any explanation for that?

\$\endgroup\$
3
  • \$\begingroup\$ after sending the CMD8, you need to receive 8 bytes of data from SPI. isn't it? \$\endgroup\$
    – MaNyYaCk
    Commented Jul 26, 2017 at 18:37
  • \$\begingroup\$ I would say 6 bytes:dummy+response+4bytes(echo of argument). \$\endgroup\$ Commented Jul 26, 2017 at 23:23
  • \$\begingroup\$ Oops. Yeah. My bad \$\endgroup\$
    – MaNyYaCk
    Commented Jul 27, 2017 at 0:09

1 Answer 1

1
\$\begingroup\$

In the last hour i did other test ... Seems solved. The difference is that before,when i wanted to to bang out the clock pulses necessary for read each command answer,i did not pay particular attention on the data sent on MOSI ,it was 0x00. Now i use 0xFF and everything works fine.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.