Again, trouble with SDMMC2 on STM32H755 in 4 bit mode -> CRC fail
Hello everybody,
after a long fight I got the SDMMC2 interface running in 1 bit mode on the STM32H755. I thought running it in 4 bit mode in the next step should be no big deal anymore; what a naive assumption...
The SDMMC is running with FATFS and FREERtos on the M7 core. The buffers for FATFS are located in RAM3. RAM3 is protected by the MPU so that DMA can work despite enabled cache.
In 1 bit mode everything works fine. I can mount the drive and I can write data. However, switching to 4 bit mode, mouting of the drive fails. I looked deeper into the code with the debugger and observed following behaviour:
The card init works fines and exits with no error. FATFS then reads the first sector (adress 0, 512 bytes) by means of DMA. Works fine. RxCmplt interrupt is called and the RTOS event releases the read function which returns no error. Data can be found in the read buffer.
Then, FATFS calls another DMA read operation. It tries to read another sector of 512 bytes at the address 8192. This is the first sector of the second cluster. This time the ISR returns HAL_SD_ERROR_DATA_CRC_FAIL. The RTOS event is not set and times out. The read function returns an error. But there is data in the receive buffer.
I have no idea, why the first read operation succeeds and the second fails. Has anyone encountert a similar problem? I hade already the 4 bit mode running on the STM32H743; but in that project it was on SDMMC1 and not SDMMC2...
Regards,
Daniel
