AnsweredAssumed Answered

Simultaneous SDCard Access Corruption

Question asked by Leif Zars on Apr 18, 2017
Latest reply on May 1, 2017 by Leif Zars

The project is set up as follows. USB with MSC access to the SDCard device, along with MFS on top of the SDCard as well.


Now I know that it is potentially unsafe for both USB and MFS to access to the SDCard simultaneously, but in this case USB is only reading, while MFS both reads and writes. So I know of no reason why this is not acceptable.


When the board boots it starts a self test, writing a few hundred K to a file via MFS and then reading it back to validate. The writing appears to go fine, but the reading randomly fails in random ways. MFS reports no issue but the data is invalid. The odd thing is that when I attempt an immediate re read of the data (1 block of 512 bytes) it is valid. Now this only happens when Windows is scanning / reading the SDCard via USB MSC, and I verified that no writes are being issued via MSC. So as soon as a compile out the MSC support or unplug the USB cable the self test works every time with no re reading necessary.


So some portion of the SDCard driver, or sub driver is being corrupted. I am not overly familiar with this driver, so I am asking for some guidance. Anyone have an idea?