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

USB packets loss

Hi,

I am using the latest SDK, with the nRF52840.

using the usbd_ble_uart example.

Created a timer that starts to send packets to the PC throw USB with a running index, the timer sends a packet every 25ms ( in 40 Hz), every packet size is 5000 bytes

I run this this timer for 45 minutes.

at the end I get all 108000 packets with a minor losses, I loss at least Four consecutive packets!

What can I do to avoid these losses !?

Best Regards

JK

  • Hi 

    Do you check the return value of the app_usbd_cdc_acm_write(..) function to see if it ever returns an error?

    When sending data over a USB BULK endpoint there is always a chance that data could be delayed, and in this case you would need to delay the transmission of data until the USB interface has time to catch up. 

    Best regards
    Torbjørn

  • Hi,

    And thank you for your reply.

    I am doing the same as before but the I added a while where if the return value from the function app_usbd_cdc_acm_write() is not NRF_SUCCESS it will be called again.

    I am having no losses anymore, but I got the packets not in the same order as I sent them !

    Can you help with that please, why The USB driver send my packets in another order and not as I sent them !? 

    Best Regards

    JK

  • Hi JK

    Is there any chance the app_usbd_cdc_acm_write() function will return an error for such a long time that the timer triggers the sending of a new packet before you have time to send the old one?

    In case this happens, do you have some method to buffer the new packet in the application, allowing you to finish sending the old one before you get on to the new data?

    Best regards
    Torbjørn

Related