USB TX latency

Hello,

We're facing an issue related to the USB IRQ. 

I've 2 EVK boards NRF52833 (let's call them EVK_1 (PTX) and EVK_2 (PRX) respectively). One of them (EVK_1) is connected via USB (CDC ACM UART) to my PC which is running an application.
This application sends commands to the EVK_1 and start measuring time.
EVK_1 sends a very tiny packet to EVK_2 (via ESB) and gets an ACK back.
EVK_1 reports back to PC.
PC measure latency time...

Problem:

Inside the ESB event handler (defined in esb_init, via "config.event_handler") I'm triggering the USB:

uart_irq_tx_enable(dev);
uart_fifo_fill(dev, " ", 1);


But apparently, writing data (TX) via USB out of the callback defined in uart_irq_callback_set(dev, ...) is taking around extra 2-2.5ms !!! (I'm not sure if it's due to the "callback interrupt" delay or physical comm).

If I write something to the USB in the same interrupt callback, the latency for TX is very low.

Related