Low ESP32-P4 TinyUSB USB-CDC throughput

nkp123
Posts: 3
Joined: Tue Jan 20, 2026 8:21 pm

Low ESP32-P4 TinyUSB USB-CDC throughput

Postby nkp123 » Thu Jun 04, 2026 11:38 pm

Hi!

I am developing an application for the ESP32-P4 using TinyUSB, running on the USB Full-Speed port and I have issues with the low throughput of the USB CDC serial port.

During binary transfer to the virtual serial port (for example using command cat test.bin > /dev/ttyACM0) I am achieving only ~2 Mbps, where I would expect more like 8-9 Mbps.

However, after some random time of the transfer (between seconds and minutes) the throughput suddenly shoots up to around 8 Mbps, which I would expect from the very start of the transfer.

What I have verified so far:
- The code is as simple as it can get:

Code: Select all

//-------------------------------------------+
// TUD + CDC
//-------------------------------------------+

uint8_t usbbuf[CFG_TUD_CDC_RX_BUFSIZE];

void usb_usbd_task(void *params)
{
    while (1)
    {
        tud_task();
        while (tud_cdc_available())
        {
            // dummy read
            tud_cdc_read(usbbuf, sizeof(usbbuf));
        }
    }
}
- There are no other FreeRTOS tasks running, except for the one calling usb_usbd_task function and the default ones
- I don't see any meaningful CPU utilization on the host and the device.
- CFG_TUD_CDC_RX_BUFSIZE, CFG_TUD_CDC_TX_BUFSIZE and CFG_TUD_CDC_EP_BUFSIZE are set to 8192 bytes
- Wireshark shows 1344 bytes URB_BULK outs from host to the device, around 400 packets/s. When throughput goes up, the packets are transmitted more frequently, around 1600 packets/s.
- The behavior is the same both on Windows and Linux

Any ideas?

Who is online

Users browsing this forum: Bytespider, Google [Bot], PerplexityBot and 2 guests