I want to preface this note by saying I am not an advanced coder and I know what I'm trying to do is way above my head but I know there is a way I'm just struggling to find any libraries or resources that will work with Particle.
What I'm trying to do is this:
I have a Particle B524 device. There is sensor data being read and logged into an SD card as CSV files. I need to get these files through a usb-c port (which is the same usb-c port I use to flash the device and send commands to my particle device) Currently the device just uploads the SD card data to a backend but I want a physical way of getting the data from the SD card without removing the card. I've looked into potentially BLE but this seems more complicated. The ideal solution is to get the particle device to act as a USB mass storage when connected to a laptop. I've looked through countless sources, but I just can't figure out the USB MSC. There are no good arduino libraries that I've found and the Nordic SDK has an example: nrf5_sdk/examples/peripheral/usbd_msc/main.c at master · particle-iot/nrf5_sdk · GitHub
but this is for the Nordic SDK of course and will not work with Particle Workbench.
ANy help of whether this is even possible, resources you may have, or especially libraries I could utilize would be appreciated.
For all practical purposes it's not possible to use a Particle device as a mass-storage device.
While the nRF52840 MCU in the B SoM can theoretically be a MSD using the nRF5 SDK, you can't directly use the SDK example from user firmware. You'd need a modified version of Device OS, which opens a whole can of worms you probably don't want to deal with. Plus you need to modify the example to run within Device OS instead of on bare hardware as in the SDK example.
What I would do run a program on a computer written in node.js and using particle-usb. It would send custom USB control requests to the B SoM, which would respond with the data from the SD card. It's not trivial and requires programming in both Javascript and C++.
You could also just use the CDC serial port as a serial stream, but then you need framing, error detection, plus all of the file transfer code on both sides.