Hello, I am going to start working with RL-ARM any time soon. We are confronting a problem that I already know is going to hurt: our controller is going to function as a mass storage device, that has to 1) handle files placed on it by the host PC 2) create files that shall be read by the host PC
now this is a problem, because the controller's file system is mounted on the PC, so the PC is supposed to handle the contents, and not the controller (I had bad experiences with this in the past...). Somebody has suggested looking at the details of FAT management in order to inform the PC about the new files - but is this reasonable, or even feasible? Is this too a dirty a trick?
As far as I understand, the PC treats a USB mass storage device much like an ordinary HDD. I doubt that the implementations of file systems in Windows or other PC OS's are designed to handle the case of filesystem data spontaneously changing on the medium: just imagine the nightmare of trying to implement such a thing. I suppose it's different with network shares (SMB/CIFS/NFS/etc.)
Yes, I was thinking that would probably be the thing to look at...
For the USB mass storage device, the file system (FAT/NTFS) is running on PC. The PC needs only raw sector access to read/modify SD card sectors. If the embedded file system changes the data on medium, the cached data on PC is nomore valid, but PC is not aware of that. To prevent file system corruption, an exclusive access to SD card is required.
If the embedded file system needs to write a file to an SD card, the USB mass storage needs to be unmounted/disconnected. In this case embedded file system has exclusive access to SD card.
When finished, the USB mass storage needs to be reconnected again (soft reconnect). Now the PC is under control. The embedded file system might still read SD, but must not modify SD card sectors.
Franc
thank you all for the advise!