ZipCPU / sdspi

SD-Card controller, using either SPI, SDIO, or eMMC interfaces
207 stars 34 forks source link

SPI initiation sequence #1

Closed watmes closed 5 years ago

watmes commented 5 years ago

Some cards can't seem to operate in SPI mode correctly without toggling the SCLK pin for 74 times or more directly before sending a CMD0. The core doesn't comply with this requirement, causing unpredictable behavior in some generic cards.

ZipCPU commented 5 years ago

@watmes , Thank you for posting this issue. Do you have a reference at all for a document or specification stating this fact? I'm not finding it anywhere in the SD Card specification. Worse, in general with SPI, the clock can typically be anything if CSn is high (inactive). This would break SPI compatibility with other devices, and in particular compatibility on shared SPI buses, if true. Dan

ZipCPU commented 5 years ago

Nevermind, I think I found in it section 6.4.1.1, Power Up Time of Card", of the SD Specifications Part 1 Physical Layer Simplified Specification. My copy is marked as version 4.1 and dated 22 January, 2013.

:/ Fixing this will break some other things, but I suppose it needs to be done.

ZipCPU commented 5 years ago

Should be fixed now. I also made the SPI bus arbitration optional (only one of my designs ever used it), and the core now supports SPI clocks as fast as half the bus rate.

Dan