|
TinyWifiDongle 0.1.0
Header-only USB WiFi dongle for Arduino
|
Runs the TinyUSB device task on one fixed CPU core. More...
#include <Esp32UsbTaskPin.h>
Public Member Functions | |
| bool | begin (int core) |
| Pin the USB task to core (0 or 1); call right after USB.begin(). | |
| bool | pinned () const |
| True once the pinned task is running. | |
Runs the TinyUSB device task on one fixed CPU core.
The Arduino core creates its "usbd" task without a core affinity, so it may run on the other core than the USB interrupt. TinyUSB's DWC2 driver of the ESP32-S2/S3 (0.21.0) has races between that task and the interrupt when they run on different cores: a bulk IN transfer can lose its "TX FIFO empty" interrupt and never complete, which stalls the network send path (see the wiki page Architecture). This class waits until the core's task is idle, deletes it and starts an identical one (for (;;) tud_task();) pinned to core, which should be the core that started the USB stack, because the USB interrupt is allocated on that core.
Definition at line 22 of file Esp32UsbTaskPin.h.
|
inline |
Pin the USB task to core (0 or 1); call right after USB.begin().
Definition at line 25 of file Esp32UsbTaskPin.h.
|
inline |
True once the pinned task is running.
Definition at line 31 of file Esp32UsbTaskPin.h.