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=20 > but doesn't read/write via SPI. > My hardware works with several card brands. Never saw a problem=20 > until now. It is an ATMega8. > These cards all initialize correctly via SPI but answer CMD25 with=20 > 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 Google= =20 > but no luck. >=20 > 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 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 .