I have been trying to run an SD card interface with LPC1766 SPI for a while, and now I am stuck in a problem in which I could not find the answer anywhere.
The problem is that SDHC cards do not respond to write and read commands as expected.
Everything works fine during initialization, which was based on the Chan flowchart and in the NXP application note. I can distinguish card versions, read OCR, CID, CSD and determine their sizes.
After this step, I start writing separate blocks every second and reading it back to check data integrity. On the Kingston SDHC 4 GB Class 4 card, I can send the first write command, but to the second, which the card does not even respond (0x00 or 0x01) to the CMD24. With the SanDisk 4 GB Class 4 card, the results are different, the card responds to each command, but when reading data, I get only zeros (I'm sure I do not write zeros). If I use SDSC cards, everything works fine.
I know that SDHCs are addressed by block, not byte, and that I need to send ACMD41 with CCS for SDHC. I also know that clock speed is not a problem (using 400 KHz to start, and then 20 μs to write / read) because I just turned on CRC checking and all cards accept commands and data. If I stop calculating CRC, all teams reject cards and data.
source share