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
  • I stumble into a similar problem, using SDK 16.0.0. After trying and failing with many experiments, I found a workaround that worked for me.
    In my case the first RX worked fine but (seemingly somewhat depending on what was done in the processing of the RX), the next byte was missing form the next RX "lines" from USB. The processing did send data back to USB with app_usbd_cdc_acm_write()

    Adding a app_usbd_cdc_acm_read_any() call to "case APP_USBD_CDC_ACM_USER_EVT_TX_DONE:" handling solved the issue and now I'm getting also the first character of the line.


            case APP_USBD_CDC_ACM_USER_EVT_TX_DONE:
                //bsp_board_led_invert(LED_CDC_ACM_TX);
                ret = app_usbd_cdc_acm_read_any(&m_app_cdc_acm,
                                            m_rx_buffer,
                                            1);
                break;



Reply
  • I stumble into a similar problem, using SDK 16.0.0. After trying and failing with many experiments, I found a workaround that worked for me.
    In my case the first RX worked fine but (seemingly somewhat depending on what was done in the processing of the RX), the next byte was missing form the next RX "lines" from USB. The processing did send data back to USB with app_usbd_cdc_acm_write()

    Adding a app_usbd_cdc_acm_read_any() call to "case APP_USBD_CDC_ACM_USER_EVT_TX_DONE:" handling solved the issue and now I'm getting also the first character of the line.


            case APP_USBD_CDC_ACM_USER_EVT_TX_DONE:
                //bsp_board_led_invert(LED_CDC_ACM_TX);
                ret = app_usbd_cdc_acm_read_any(&m_app_cdc_acm,
                                            m_rx_buffer,
                                            1);
                break;



Children
No Data
Related