I have an application where a unit contains a nrf52840 and will act as a central device, collect the data from peripheral device and store into the onboard memory. Upon the completion of the collection,The data must be fetched from the unit using a USB cable. The unit must be self contained, so using the SD card is not a feasible option. I checked the USB mass storage example that uses 64Mbit NOR flash and mounts it as a USB mass storage. Which is too low capacity for my need. So I am considering to use MX66L2G45G, which is in the same product line with 2Gbit Capacity and I suppose the SDK library will support that out of the box (correct me if I am wrong here). Can the SDK library create a file system for 2Gbit and mount it as a USB drive just as shown in the example? Or will I run into problems?When I ran the example, I saw that I could also drag and copy the data from the computer to the flash. For my need, i need that USB mass storage to be read only. Any suggestion on the best way to do all this?
The USB MSC Example demonstrates most of what you describe here. It can use both internal flash memory, and (more relevant in your case) external flash memory via QSPI. I do not have experience with the MX66L2G45G, but I would be surprised if you run into significant problems. The example is not read-only, but that is supported by the underlying FatFs by setting the _FS_READONLY define in ffconf.h.
Hi Einar,Since its a global def, If I set the _FS_READONLY, I wouldn't have any access to write functions. I want to write to the filesystem locally when its not mounted, and only do read only when its mounted as USB mass storage.
Yes, that is true. The SDK does not have any example where you can dynamically change between read-only and writable. Perhaps there are other file system implementations that make it easier, but I don't know of any.