AnsweredAssumed Answered

_esdhc_read, SD, and cache?

Question asked by pbanta on Nov 18, 2014
Latest reply on May 24, 2019 by soham dandapat

My environment:  MQX 4.1, MFS, K70FX, eMMC, DDR


I'm writing a small ascii file to MFS installed over the SD card driver.  When I try to display the contents of the file (using the "type" shell command) I can see corrupted data sometimes.  Not all the time.  I have noticed that if I create multiple files and then "type" them from the shell, sometimes the data printed to the shell is good and other times the data is corrupted.  I have tracked the corruption to the esdhc driver.  I am seeing data corruption when the ADMA engine transfers data to DDR.  After the transfer is complete the buffer in DDR contains some new data mixed with old data.  For example, if I "type" file1.txt and then "type" file2.txt, the data printed to the screen contains file1.txt data intermixed with file2.txt data.


I don't understand the ESDHC_IS_HANDLING_CACHE code.  What is the purpose of head, body, and tail?  It looks like ESDHC_IS_HANDLING_CACHE is not meant to be optional.  It's forced true in esdhc_prv.h.


I'm also wondering if the problem may be related to the clock domains between the eMMC and DDR.  I've run pattern tests, walking ones/zeros over the address range of DDR with no errors.  My eMMC clock is running at approximately 750kHz and the DDR clock is 120MHz.  I think the ADMA is sitting in the middle transferring data from SDHC_DATPORT to DDR.


Has anyone seen any issues like this before?