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

USBD high level API usage question

Hello,.

I have a question about using app_usbd_cdc_acm_read and app_usbd_cdc_acm_read_any in SDK15.2.0,

I am not sure I fully understand the description in reference of app_usbd_cdc_acm_read call:

According to this description, when there is not enough data in internal buffer can fill user buffer, the call will return a NRF_ERROR_IO_PENDING, so what will happen to the data stored in internal buffer now? will the data be copied to user buffer or just stay there waiting for enough data arrived ? if the data is copied to user buffer, then will APP_USBD_CDC_ACM_USER_EVT_RX_DONE will be raised at this point? 

However, if the data is not copied to user buffer, then what will happen if, the expected receiving size if larger than internal buffer size, say, 256bytes or even larger? won't the data in internal buffer overwritten by coming bytes?

thank your for your help!

/Roland

  • I did some other testing about the 840 USBD interface from a MACBook using ttyusbxxxx interface, with a piece of code running on MAC that read/write from/to 840. 

    According to the few test results so far,  this time the result looks the same as you advised.Thanks a lot for your support. I will do further more testings to look into the details.

    BTW, I am still using timer on 840 side to fire USB_READ_ANY operations, as I assume this way CPU can share more idle time with other tasks.

Related