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

USB throughput for nRF52840

I have developed USB firmware for the 840 based on the USBD example so that we can use WINUSB (WCID) for the host.  The design is for USB 2.0 full speed with EPIN1 for device to host transfers and EPOUT1 for host to device transfers The firmware passes test for 60, 64 and 192 byte tests when they are manually triggered from a Windows test tool we wrote.  I just moved onto loop testing to validate throughput and the device seems unable to work at speed with more than 64 bytes in a transfer (tested at 1 , 10 and 100 MS rates).  I've examined the descriptor file (usbd_desc.c) and the USB code (usbd.c) but can't find an issue.  I am suspicious of how I handle receive packet for NRF_DR_USBD_EPOUT2 in the event handler but it does work with the manually triggered testing.  attached is a zip of my project (I am using the template example as a base).g4_boost_snapshot_041320_0912AM_start of day.zip

Parents Reply Children
  • well it is not the matter of "have to". It is just that using app_usbd for handled trasactions would make the behavior more predictable and easier for us

  • I've chosen to build this on the USBD example to avoid uses classes since I have never used them.  The examples that use app_usbd are all based on class usage and seem pretty complex as opposed to the USBD example.

  • I am not very familiar with this driver, so I am not certain. Could it be that that the call to nrfx_usbd_ep_transfer failed with error and you did not handle it? saying this since your code ignores the return value to the call nrfx_usbd_ep_transfer. 

  • Can you provide some insight into the nrfx_usbd_ep_transfer function?  I am trying to run 512 byte data over bulk endpoints at a sustained frame rate (say 5 MS) and am having some trouble.  The code is based on your USBD example with modifications to convert to bulk transfers, add EPOUT2 and EPIN1 endpoints and modify the descriptors to identify as a WINUSB (WCID) device.  The code connects to the WINUSB driver and correctly responds to manually triggered data but is dropping frames in this sustained testing.  My understanding is that the ep_transfer() function accepts any size packet and will packetize it (64 byte packets for bulk) and also attach a zero length packet (ZLP) in this case since the data size is a multiple of the endpoint buffer size.  In my code, I transfer the buffer and then wait for the endpoint transfer to complete using nrfx_drv_usbd_ep_is_busy() function before exciting my transfer function.  This sequence would seem to make my transfer function block and therefore ensure that the endpoint is ready for another transaction once I have exited to main.  The system is behaving like it has a race condition and it is sensitive to the frame time but performance does not improve when extending the frame (even to 100 MS).  I am also seeing large delays in the completion time for the USB transfer, up to around 7 MS in some cases.  Any suggestions?

Related