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

nrf52840 usbd problems

Hi,

I use nrf52840, I meet some problems about the USBD, Can you help me?

We know that the usb device send data to host(such as PC) by EPIN:

(1) The host send IN event, But devie send NAK to host, because  LOCAL BUFFER do not have any data, So many IN-NAK is happening.

(2) Then I send some data to the local buffer by DMA,  when the next IN is come, the device send DATA to host, and then host send ACK to device, and then the EPDATASTATUS will be set.

My question:

Sometimes, when the device send DATA to host, I capture that the last CRC byte is missing, the host receive just one CRC byte(it must CRC16, is two bytes), The previous data is normal, I do not know the reason, maybe some hardware problems becauce of BLE modle.  and then, the host don't send ACK to device. Actually, the host don't send anything, and the EPDATASTATUS will not be set. The device USBD is now mark this EPIN as error status , because When PC send next IN event, the device resend the same data+crc, but this time , it's normal.

My question is that:

When the device USBD mark the EPIN as error status, is there any way that i can clear the status , because i don't need the device resend the right data+crc when the next IN come. It will mess up my application logic. 

Looking forward to your reply, thanks!

  • Hi 

    It appears you are not using our USBD drivers, is that correct?

    I would strongly advice against this, as we have spent a lot of time on these drivers to ensure that they work reliably with the chip. Most likely will you  have to spend significant development time to implement a similar driver, and it is much harder for us to support you if you don't use the official drivers. 

    unrulife said:

    Is stalling the EPIN[3] by EPSTALL register will clear the error status ?

    Could you help me to find some way , or ask for the developer ?

    The developer mentioned that running the nrfx_usbd_ep_abort() function might clear this error status, but again he strongly suggested switching to the official drivers in the SDK. 

    Best regards
    Torbjørn

Related