|
|
|
|
|
by elipsitz
1048 days ago
|
|
I had a project where I needed predictable timing for I/O (reading a microprocessor’s bus at 1 MHz), and the ESP32 I was using just couldn’t do it reliably. Despite having a tight loop on a dedicated core with interrupts disabled, a loop iteration would sometimes take longer than a microsecond, causing it to miss some I/O. I was able to do it much more reliably with RP2040’s PIO. For another project, the ESP32 family unfortunately doesn’t have a model that has both Bluetooth Classic (only the original ESP32 does) and USB host/device modes (only ESP32-S2 and ESP32-S3 do), so I’m thinking I’ll use the RP2040 as the main processor, with USB, and an ESP32 coprocessor. I really would rather just use a single ESP32, but that isn’t looking like an option here. |
|
You should either:
* have a timer triggering interrupt that reads the data
* have a timer triggering DMA from the input port (if it was whole 8/16 bit) directly to memory
* trigger an interrupt with microprocessor's clock bus and read it directly.
Technically the 2nd one should have zero jitter (aside from clock itself).
Busy loop is the worst case on a microprocessor running RTOS to do the other stuff.