Hi,
I am trying to make a USB to BLE (central) device with nRF52840. I have removed the end character check from the "usbd_ble_uart" example and used a 50ms timeout instead. However, when sending about 240 bytes of data, the timer reaches the timeout value. It is not expected as I thought the device supports at least USB 2.0, which has 480Mbps or 12Mbps data rate, later I found the device is only capable of much lower speed (https://devzone.nordicsemi.com/f/nordic-q-a/38822/usbd-with-cdc-acm-class-windows-10-maximum-data-rate CDC ACM binary file transfer (Windows): 215 kB/s (1720 kbit/s).
Is there any way to improve the transfer rate? As my setup shows much lower speed than given in forums, as it cannot transfer 240 bytes within a 50ms window. Is it possible to get 100kbps with the device working as BLE central as well?
The code is given below:
case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:
{
ret_code_t ret;
//NRF_LOG_INFO("Bytes waiting: %d", app_usbd_cdc_acm_bytes_stored(p_cdc_acm));
nrfx_timer_pause(&m_usb_cdc_timer);
nrfx_timer_clear(&m_usb_cdc_timer);
do
{
/*Get amount of data transferred*/
size_t size = app_usbd_cdc_acm_rx_size(p_cdc_acm);
rx_buffer += size;
//NRF_LOG_INFO("RX: size: %lu char: %c", size, *rx_buffer);
/* Fetch data until internal buffer is empty */
ret = app_usbd_cdc_acm_read_any(&m_app_cdc_acm,
rx_buffer,
READ_SIZE);
} while (ret == NRF_SUCCESS);
nrfx_timer_resume(&m_usb_cdc_timer);
break;
}
Other question is, how to re-assign buffer to "app_usbd_cdc_acm_read_any" function before APP_USBD_CDC_ACM_USER_EVT_RX_DONE event? Because the buffer pointer increments during the "APP_USBD_CDC_ACM_USER_EVT_RX_DONE" event (see the code) which should be set to the beginning of the buffer on timeout event.
Thank you.
Ras