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

"usbd_ble_uart", how can I steer the speed of USB communication?

HI.

I have modified "usbd_ble_uart" a little bit and have changed the BLE service for transfering the received data from USB over BLE.
The problen is now, the BLE service needs (of course) more time to transfer the date to the peer device than the USB delivers data.

How can I control the received data amount over USB? I have seen some notes about handshake signals using "app_usbd_cdc_acm_serial_state_notify", but my tests have not worked so far.

Thanks in advance
Cheers Mike

Parents
  • Hi Mike

    The USB protocol has it's own method for flow control where one side of the link can NAK packets if the internal buffers are full. 

    A simple way to make this happen from the application side is simply to stop calling the app_usbd_event_queue_process() function from the while loop in main. Then you will stop reading out data from the USB driver, and eventually it will start NAK-ing any incoming packet from the USB host. 

    In other words you should stop calling this function once you get the RESOURCES error from the SoftDevice, and then start calling it again once you have successfully sent some data over the SoftDevice. 

    Best regards
    Torbjørn

  • Hi Torbjorn.

    Thanks, I have already done a try, it works better now. I will improve my implementation now.
    But I have to use the event APP_USBD_CDC_ACM_USER_EVT_TX_DONE to bring the event APP_USBD_CDC_ACM_USER_EVT_RX_DONE back to work.

    Is there another way to re-enable APP_USBD_CDC_ACM_USER_EVT_RX_DONE?

    Best regards and enjoy the weekend.
    Mike

  • Hi Mike

    That's a bit odd, resuming execution of app_usbd_event_queue_process() should be enough to get the events running again. 

    What if you try to call app_usbd_cdc_acm_read(..), to see if there is any pending data in the buffer?

    Best regards
    Torbjørn

Reply Children
Related