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

Implementing USB Media Transfer Protocol

Hi,

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?

Parents
  • Hi

    I'm also interested in MTP for several reasons. With MTP I could
    a) deliver status and get/set config of my device as text file
    b) present sensor result values as "temperature_2021-03-28.csv" and "temperature_2021-03-28.json" and produce/format the file content on the fly
    c) firmware update for dummies (just drop the file)

    Yes, most could also be done with MSC.
    But files "popping up" when a measurement is terminated is not possible when the host OS is the boss of the file system.
    And detach/reattach for every change will lead to "drive not present" when an application wants to check for new results regularly.

    I looked at the above mentioned code from Bosch. This is clearly a good solution in the Bosch context. But IMHO this implementation does not fit with the concepts of nRF52 SDK. I would much prefer an approach which adopts the existing concepts and integrates smoothly  with the Nordic library. So I started with the Nordic CDC implementation and adapted the code to reflect MTP instead of CDC.

    I'm a newbie in MTP and not experienced in USB either, therefore I progress very slowly and the resulting code is of questionable quality.
    But if somebody wants to join the effort, I'll put the evolving code in a git repository.
    (or just wait a couple of weeks until it starts to work...)

    have fun
    Peter

    EDIT 17.04.2021: now I can list files and read a dummy text file on Linux and Windows 10. Making it work on Linux did take some effort but it was a piece of cake compared to make the same work on Windows.

Reply
  • Hi

    I'm also interested in MTP for several reasons. With MTP I could
    a) deliver status and get/set config of my device as text file
    b) present sensor result values as "temperature_2021-03-28.csv" and "temperature_2021-03-28.json" and produce/format the file content on the fly
    c) firmware update for dummies (just drop the file)

    Yes, most could also be done with MSC.
    But files "popping up" when a measurement is terminated is not possible when the host OS is the boss of the file system.
    And detach/reattach for every change will lead to "drive not present" when an application wants to check for new results regularly.

    I looked at the above mentioned code from Bosch. This is clearly a good solution in the Bosch context. But IMHO this implementation does not fit with the concepts of nRF52 SDK. I would much prefer an approach which adopts the existing concepts and integrates smoothly  with the Nordic library. So I started with the Nordic CDC implementation and adapted the code to reflect MTP instead of CDC.

    I'm a newbie in MTP and not experienced in USB either, therefore I progress very slowly and the resulting code is of questionable quality.
    But if somebody wants to join the effort, I'll put the evolving code in a git repository.
    (or just wait a couple of weeks until it starts to work...)

    have fun
    Peter

    EDIT 17.04.2021: now I can list files and read a dummy text file on Linux and Windows 10. Making it work on Linux did take some effort but it was a piece of cake compared to make the same work on Windows.

Children
No Data
Related