FX3S MSC with FAT FS | Cypress Semiconductor
FX3S MSC with FAT FS
I'm just starting off with the FX3S USB controller and going through some of the examples to get a feel for it. I've managed to get the MSC example that ships with the latest SDK for the FX3S (cyfx3s_msc.c), which utilises an SD card to create a mass storage.
I've been then trying to create a 0kb file object on the mass storage, but have had no luck. The file system I've used (ChaN's FAT FS module) is the one used in the file system example that also ships with the SDK for the FX3S (cyfx3x_fatfs.c). I can create the file system object fine using the f_mount function, but when I try to create the actual file object itself using the f_open function, the thread seems to stall or crash. Subsequently, the mass storage will not be created for the SD card.
Doing some testing, I've found that this is only the case if I've created the file system object to the storage port of the SD card inserted where I want to create the file object. If there is no file system object created on that port, no SD card insert, or the SD card is write protected, I get a return code error indicating either write protection or invalid drive.
I've racked my brain for a solution but to no avail; I feel like I am missing a step somewhere - I've followed the cyfx3x_fatfs.c example in creating the file object in the main thread after initialising everything, but from what I understand, that example utilises a small portion of the FX3S RAM to act as the storage to create the file system and file objects, whereas I am using the SD card as my storage, which could be why I am running into these issues.
Any help would be greatly appreciated. Cheers.