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

52840 USB CDC missed first byte in RX event

Hi,

I used 52840DK and SDK15.2 to test usb cdc, every thing goes will, but in rx event, it always missed first byte, for example, if send "123456", it just received "23456", if send just "1", there is no rx event. though I can see the first byte right in the internal_rx_buf, but how to make the rx event correctly receive first byte?

thanks!

Brian. 

Parents
  • Hi Brian,

    Was able to reproduce the exact same behavior here and it seems to be caused by a logical error in the app_usbd_cdc_acm.c->cdc_acm_rx_block_finished() implementation. It "worked" when I commented out the following lines:

    // First buffer is full
    p_cdc_acm_ctx->last_read = p_cdc_acm_ctx->bytes_read; //+ bytes_to_cpy;
    p_cdc_acm_ctx->bytes_read = 0;
    p_cdc_acm_ctx->bytes_left = bytes_read; // - bytes_to_cpy;
    p_cdc_acm_ctx->p_copy_pos = p_cdc_acm_ctx->internal_rx_buf;// + bytes_to_cpy;

    However, it breaks the buffer switching so would not suggest to make this change. I have reported it as a bug internally. 

    Regards,

    Vidar

  • Hi,

    Any updates about this issue? Will the patch be available in the next release of the SDK?

    Best,

    Chris

Reply Children
No Data
Related