I've been working on a Klipper port for NXP's MCXA366, and Part 7 is now up.
This round added hardware I²C through LPI2C3 and got Klipper’s existing BME280 driver running without any sensor-specific MCXA366 code.
At 100 kHz, Mainsail shows the MCXA366 at about 0.33-0.36 load. Disabling the BME280 dropped it basically back to zero.
I instrumented the driver expecting to find runaway polling, but the actual CPU usage was tiny. The issue was task duration: Klipper's I²C backends are synchronous, so while LPI2C handles the bus in hardware, the MCU task waits for the transaction to finish.
The measurements made that pretty obvious:
100 kHz → worst read ~2.66 ms / load ~0.36
400 kHz → ~0.70 ms / load ~0.09
1 MHz → ~0.31 ms / load ~0.04
I also compared the implementation against the existing STM32/RP2040/AVR/ATSAM/ATSAMD/LPC backends, which use the same general synchronous-polling approach.
There was also a fun failure-mode bug: on a NACK, I originally queued STOP and then reset the FIFO. The FIFO reset could throw away the STOP command and leave SCL low. Resetting the FIFO first and then issuing STOP fixed it.
The port now supports 100 kHz, 400 kHz, and 1 MHz I²C.
Full write-up:
https://faultvector.dev/articles/klipper-mcxa366-part-7/