Data mixing with CDC ACM & CLI

Hello,

I have a problem when I send data with CDC ACM and using CLI interface my data is mixing. If I put a delay between sending data I have no problem but this solution is not very clean. 

Have you got an idea of why I can fix this problem?

Thank You,

Téo 

Parents
  • Hi

    After discussing this with a colleague, I think we need some more details, as there shouldn't be a problem running multiple CDC ACM com ports. I guess it could have something to do with how you transmit the data. Can you show some details of how this is done exactly? Are you for example transmitting from an interrupt?

    Also, what do you mean by APP_USBD_CDC_ACM_USER_EVT_TX_DONE  always being 1? This is an event, and not a variable. How are you using this event exactly? As app_usbd_cdc_acm_write says, you should wait for the APP_USBD_CDC_ACM_USER_EVT_TX_DONE  when writing to make sure that all data has been set and the input buffer can be accessed again.

    Best regards,

    Simon

Reply
  • Hi

    After discussing this with a colleague, I think we need some more details, as there shouldn't be a problem running multiple CDC ACM com ports. I guess it could have something to do with how you transmit the data. Can you show some details of how this is done exactly? Are you for example transmitting from an interrupt?

    Also, what do you mean by APP_USBD_CDC_ACM_USER_EVT_TX_DONE  always being 1? This is an event, and not a variable. How are you using this event exactly? As app_usbd_cdc_acm_write says, you should wait for the APP_USBD_CDC_ACM_USER_EVT_TX_DONE  when writing to make sure that all data has been set and the input buffer can be accessed again.

    Best regards,

    Simon

Children
  • Hi

    I'm facing the same problem.
    I'm using nrf_cli_print_stream() from the nrf_cli library (which uses CDC ACM library) to send chunks of raw data.

    The problem is that when I try to send several chunks, some data is lost, as if I didn't wait for the buffer to be ready.

    I noticed that the function cli_write waits for the tx_rdy flag, which is set by the cli_transport_evt_handler which is called by cdc_acm_user_ev_handler when APP_USBD_CDC_ACM_USER_EVT_TX_DONE event is detected.

    That being said, I should be able to call nrf_cli_print_stream() several times in a row without having my data mixed up or lost, right?

    Also I am using SDK 17.1

    Thanks for your help

Related