We are currently evaluating a project, that uses the nrf52840 with an SD card and is connected as a USB device. One of the uses is the MCU is writing data to the SD card, while the USB interface can be used to transfer data out of the device.
Our initial plan was to use USB mass storage device class, since it does not require custom software on the USB host PC, but unfortunately, it interacts with SD card blocks directly, making it impossible for the MCU to also write to the SD card at the same time.
As an alternative, we are investigating the use of USB Media Transfer Protocol, it provides similar functionality, but interacts with the device on the file system level and not block level. This allows both the MCU and the USB host to interact with the file system at the same time.
Unfortunately, MTP does not look like it is supported by the existing USB stack/library. Is there anyone who successfully managed to implement MTP on top of the existing USB stack?
Not aware of such example now, I don't really have any suggestion for workaround either.
Its not the answer I was looking for, but appreciate you taking the time.
I am looking at if something like this could be ported. It would need to be modified for the file system and usb driver, but it could be do-able.
We too are trying to write data to SD card while the USB interface is copying the data out. Can I know what was the result of your evaluation. Were you able to achieve the required functionality?
Please have a look at the USB MTP implementation for nRF52840 by Bosch Sensortechttps://github.com/jabezwinston/COINES/tree/master/coines_api/mcu_app30/usb_mtp