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

USB Bulk transfers with the app_usbd library

Hi DevZone,

I want to perform USB bulk transmits to a host device while using the app_usbd library. I am using SDK 15.3 and the s140 soft device is enabled.

I have found the app_usbd_ep_transfer() and app_usbd_ep_handled_transfer() functions in the app_usbd.c file at line 1816 and 1831.

Can I use these directly in my user code and does the library have built in scheduling/handling so I don't run into concurrency issues with the end point I am using?
I have not been able to find information on this in the Nordic info center, and I am having a hard time figuring it out by looking in the library code it self Slight smile

Br. Casper

  • Hi Casper

    Normally these functions are called in the background by whatever class implementation is running on top. 

    Have you looked into using one of the standard classes, such a CDC, rather than using the app_usbd library directly?

    I can check with the developer if there are any particular considerations to take when using app_usbd directly. 

    Best regards
    Torbjørn 

  • Hi ovrebekk, (Edit, misspelled name)

    Sorry for the very late reply, I have been attending a course that took 100% of my time these past days.

    I have not been looking into the SDK implementation of the USB CDC class directly. This is because the research I did on it showed that it works as a Virtual Serial Port. By this I assume that it would be like using UART with and FTDI and the connecting with a terminal program such as Termite or PuTTY. 

    The planned use of the USB interface is:
     - Using the USB to send and receive commanding/telemetry between the host PC and the nRF52840 chip.
     - Sending data log files from the FATFS system on the nRF52840 to a host PC as fast as possible, as these can be large.

    Have I misunderstood how the CDC works or would it actually work well for my application?

    Br. Casper

  • Hi Casper

    CDC and virtual comport is essentially the same thing, yes. Your device will look like a comport on the host (PC) side, and you can connect to it using either a standard terminal program, or a serial interface in a custom application, if you want to develop your own desktop application to interface to the device. 

    CDC does not have a baudrate limitation in the same way as a physical UART, and is more limited by the USB hardware and stack. In our testing we have found the CDC example to yield approximately 215kB/s transfer speed on Windows, and over 300kB/s on Linux. 

    Best regards
    Torbjørn

  • Hi ovrebekk,

    There is going to be a desktop application that interfaces with the device yes. CDC might just work then. :)
    And thank you for the transfer speeds.

    Though I am curious, I have not been able to find a USB example that is purely a USB Bulk device. Is this because it does not exist, or have I just overlooked it?

    Br. Casper

  • Hi Casper

    There are no pure USB bulk examples in the SDK, that is correct. All the existing examples are for defined USB classes such as HID, MSC and CDC. 

    Best regards
    Torbjørn

Related