That's great. Sounds like the card was still in delivery-of-response state, so it was ignoring the new commands. On Fri, Mar 31, 2017 at 10:44:38AM -0300, enkitec@gmail.com wrote: >=20 > James, the CMD12 trick solved the problem! Thanks for your idea! > After some investigation I found that two dummy reads before CMD25=20 > also works. > The last command I issued on the card initialization phase was CMD9= =20 > to read the card CSD. > It seems the CSD response has 18 bytes to read instead of the=20 > regular 16. > So these cards need two more reads after CMD9 to be happy! >=20 > Regards, > Mark Jordan >=20 >=20 >=20 > On 30-Mar-17 22:34, James Cameron wrote: > > On Thu, Mar 30, 2017 at 12:04:10AM -0300, enkitec@gmail.com wrote: > >> I've got some micro SD cards that work ok when connected to a PC > >> but doesn't read/write via SPI. > >> My hardware works with several card brands. Never saw a problem > >> until now. It is an ATMega8. > >> These cards all initialize correctly via SPI but answer CMD25 wi= th > >> 0xC1 and CMD18 with 0xC2. The correct answer should be 0x00. > > Not only that, but the response token should have zero MSB to be > > treated as legitimate. 0xC1 and 0xC2 do not have a zero MSB. > > > >> Can't find any solution to this odd behavior. Spent hours on Goo= gle > >> but no luck. > >> > >> Any suggestions? > > Is the card offering more bytes than you read? There's a legitimate > > option in the specification to send more bytes; format R1b. > > > > I would try a CMD12 after detecting the bad reply, then try the CMD25 > > or CMD18 again once more, see if it is different second time. > > > > You might capture the entire conversation and attempt a materials > > return or support request based on non-compliance. ;-) > > > > Likely that SPI mode is not as well tested on new card firmware, > > especially firmware from rushed or low-cost production. > > > >> Thanks. > >> Mark Jordan >=20 > --=20 > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 James Cameron http://quozl.netrek.org/ --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .