Hello dear Nordic Semiconductor.
I use one of your creation - nRF52840 USB dongle. I have troubles with using USB CDC ACM.
I add ble stack to gather info about advertisement and wnat to send some data via USB CDC ACM. Sending is okay. But receiving data from pc to usb dongle is not okay. It misses packets. What can be the reason?
Also want to ask if it is possible to use TLSv1.2?
Example of my code that is working:
case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:
{
// bsp_board_led_invert(LED_CDC_ACM_RX);
ret_code_t ret;
m_send_flag = 0;
wr_idx = 0;
memset(m_tx_buffer, 0, NRF_DRV_USBD_EPSIZE);
// NRF_LOG_INFO("Bytes waiting: %d", app_usbd_cdc_acm_bytes_stored(p_cdc_acm));
do
{
/*Get amount of data transfered*/
size_t size = app_usbd_cdc_acm_rx_size(p_cdc_acm);
// NRF_LOG_INFO("RX: size: %lu char: %c", size, m_rx_buffer[0]);
// memcpy(m_tx_buffer, m_rx_buffer, size);
if (size == 1)
{
memcpy(&recv_buf[cnt_idx], &m_rx_buffer[0], 1);
cnt_idx ++;
/* Fetch data until internal buffer is empty */
ret = app_usbd_cdc_acm_read_any(&m_app_cdc_acm,
m_rx_buffer,
size);
}
else
{
memcpy(&recv_buf[cnt_idx], &m_rx_buffer[0], size);
cnt_idx += size;
/* Fetch data until internal buffer is empty */
ret = app_usbd_cdc_acm_read_any(&m_app_cdc_acm,
m_rx_buffer,
size);
}
} while (ret == NRF_SUCCESS);
m_send_flag = 1;
bsp_board_led_invert(LED_CDC_ACM_RX);
// xSemaphoreGiveFromISR(USB_CDC_RX_Mutex, &xUSB_CDC_RXTaskWoken);
// /* If xUSB_CDC_RXTaskWoken was set to true you
// we should yield. The actual macro used here is
// port specific. */
// portYIELD_FROM_ISR( xUSB_CDC_RXTaskWoken );
break;