This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840 Mass Storage file handling

Maybe I understood something wrong, but I wonder if it is possible to have the nRF52840 handle file transfers like it does with the firmware hex-files. Say, I want my nRF52840 PDK to show up as a mass storage device and I want my users to be able to configure the device by drag & drop'ping a config.txt file to the mass storage device - is this possible? Of course I actually don't want to store the file, I just want to read it once to transform the config and store it in RAM

  • I'm experimenting with something similar at the moment. Check out the USB mass storage example at $SDK_ROOT$\examples\peripheral\usbd_msc

    You can configure the block devices to use only a RAM disk (modify BLOCKDEV_LIST), then format the disk using fatfs_mkfs() on startup. After the USB init, the device should show up on the host OS as a small, empty FAT drive, and you can copy your config file over to the device.

    That's as far as I've gotten - but what you're trying to do seems feasible. You'll obviously need some more code to find/open/parse the file after the transfer completes. This might be problematic, because there are numerous warnings that the file system should not be accessed while USB is active (due to concurrency issues, I think). You can probably work around this somehow.

Related