the SD protocol puts the crc at the end of a read, not the startI am now reading the card and its MBR but have found the read block command (CMD17) returns a 64 byte data block before the actual 512 bytes of the requested sector. I assume this is CRC related
i believe the proboelm your seeing, is that the sdhost keeps shifting the DAT pins into the FIFO, even after a read completes
and the FIFO can only hold 64 bytes of data, so it gets jammed with garbage at the end of each read
https://github.com/christinaa/rpi-open- ... #L335-L343
Code:
void drain_fifo() {wait();while (SH_HSTS & SH_HSTS_DATA_FLAG_SET) {SH_DATA;mfence();}}virtual bool read_block(uint32_t sector, uint32_t* buf) override {if (!card_ready)panic("card not ready");if (!is_high_capacity)sector <<= 9;/* drain junk from FIFO */drain_fifo();
Statistics: Posted by cleverca22 — Tue Oct 08, 2024 12:13 am