This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB endpoint transfer pipe error

Hi,

I'm trying to evaluate the performance of USB and using USB MSC example to do bulk transfers in between host (PC) device (nRF52840)

I'm using libusb on PC side and sending 64 bytes of data in a loop using bulk transfer. On device side I'm using 'app_usbd_ep_transfer' function in a loop on NRF_DRV_USBD_EPOUT1  endpoint of the interface.

I see the first 64 bytes of transfer is received successfully but after that I get pipe error on libusb side and can't continue to bulk transfers. How can I call this function in a loop? Should I call another function to wait/clear some flags until/after the transfer is completed? Is there a usb device example code which would help with handling the endpoint data transfers in a loop?

Thanks and Best Regards,

Asli

  • Hi,

    Looking at the documenation here, libusb_bulk_transfer () returning LIBUSB_ERROR_PIPE , means that the endpoint is halted. I think you might need to call libusb_clear_halt, and then try again. Take a look at this code here.

    We dont't have any libusb CDC MSC driver examples, but we have a libusb USB CDC ACM driver for javascript found here.

  • Hi Sigurd,

    I'm calling libusb_clear_halt() after each bulk transfer on libusb side when there's LIBUSB_PIPE_ERROR already. On Nordic side the program is stopping at line#100 (NRF_BREAKPOINT_COND) of app_error_weak.c file  with '[00:00:00.046,417] <error> app: ASSERTION FAILED at ..\usbd\class\msc\app_usbd_msc.c:2093' . ( ASSERT(0);
    ret = NRF_ERROR_NOT_SUPPORTED;)

    I think I'm doing something wrong on the Nordic side. Is any of the usb examples showing how to handle the incoming data from host to device in a loop or something similar I can use? 

    Thanks,

    Asli

  • 1) Have you made any changes to the usbd_msc example ?

    2) Are you using a nRF52840-DK version 1.0.0 ?

    3) Are you using SDK 15.2 ?

    Could you try to set APP_USBD_MSC_CONFIG_LOG_ENABLED to 1 and APP_USBD_MSC_CONFIG_LOG_LEVEL to 4 in sdk_config.h , and see what the log output is ?

    The endpoint_out_event_handler() should then print the internal module state.

    If you want RTT logging, set NRF_LOG_BACKEND_RTT_ENABLED to 1. You might also want to set NRF_LOG_DEFAULT_LEVEL to 4.

  • 1) I just added below buffer as global to the msc main.c file

    static uint8_t data_from_host[64];

    NRF_DRV_USBD_TRANSFER_OUT(epOutTransfer, data_from_host, 64);

    and I'm calling in the while loop, in main function

    ret = app_usbd_ep_transfer(NRF_DRV_USBD_EPOUT1, &epOutTransfer);

    2) I have a Rigado BMD-340 evaluation board.

    3) Yes

    I enabled the logging as recommended. I get below: 

    [00:00:00.000,000] <info> app: Mounting volume...
    [00:00:00.000,000] <error> app: Mount failed. Filesystem not found. Please format device.
    [00:00:00.000,000] <info> app: USBD MSC example started.
    [00:00:00.000,000] <info> app: USB power detected
    [00:00:00.000,000] <info> app: Un-initializing disk 0 (QSPI)...
    [00:00:00.000,000] <info> app: USB ready

    [00:00:00.021,118] <debug> usbd_msc: state: 0, ep out event, status: 0
    [00:00:00.021,118] <error> app: ASSERTION FAILED at ..\components\libraries\usbd\class\msc\app_usbd_msc.c:2093

    Thanks,

    Asli

  • Hi,

    ASLI said:
    1) I just added below buffer as global to the msc main.c file

     Could you upload the main.c you are using?

    ASLI said:
    [00:00:00.000,000] <error> app: Mount failed. Filesystem not found. Please format device.

     Are you able to get the filesystem to mount on the  BMD-340 with the unmodified example?

    Are you using the QSPI/ external flash on the BMD-340?

Related