Verify ESP32 80 MHz APB UART timing across baud rates
ESP32 UART peripherals clock from the 80 MHz APB bus (or 40 MHz XTAL on newer S3/C3 chips) using a fractional clock divider (`UART_CLKDIV_REG`). Even at non-power-of-two rates like 115,200 bps and 921,600 bps, the fractional prescaler holds timing error far below 0.2%.
When pairing ESP32 with an RS-485 Modbus network using 8E1 or 8N2 (11-bit frames), verify both quantization error and total stop-bit drift across the 40 ppm crystal tolerance.
Formulas
APB_CLK = 80 MHz; ideal CLKDIV = 80,000,000 ÷ 115,200 = 694.444…ESP-IDF truncates CLKDIV × 16 to 11,111, giving 694 + 7/1611-bit frame stop-bit sample at 10.5 bit times
Worked example
At 80 MHz APB and 115,200 bps, the programmed divider produces 115,201.2 bps (+0.001% error).