Adding more UART ports to PX4 hardware (e.g. via SPI UART expanders)

Hi PX4 devs,

I’d like to ask a more conceptual / architectural question about adding more UART ports on PX4-based hardware.

From a professional / commercial user point of view, there are use cases where having more point-to-point UART interfaces would be beneficial, even if they don’t require very high data rates.

One idea I’ve been thinking about is using an SPI-connected multi-UART expander, for example something like the MAX14830, to add up to 4 additional UART ports over a single SPI bus.

My questions are mainly around what the “right” way would be in the PX4 ecosystem:

  • Is this kind of approach considered reasonable / aligned with PX4 design philosophy?

  • If one were to pursue this, where should support ideally live?

    • At the NuttX level (as a generic UART driver exposed to PX4)?

    • Or handled more at the PX4 layer as a specific driver/module?

  • Any known pitfalls in terms of timing, scheduling, or maintainability when multiplexing UARTs over SPI in a flight-control context?

At this stage I’m not pushing a specific implementation, just trying to understand what would make sense architecturally and what the trade-offs are. I’d especially appreciate comments or guidance from the more senior dev team or anyone with experience in PX4 low-level drivers.

Thanks in advance for any insights!

I think the question is not whether it can be done, but whether it should be done. For streaming data (eg, mavlink streams) this seems reasonable. But for connecting other serial devices (GPS, lidar, etc) sharing a bus is going to be tough. The timing in command/response protocols matter, and having multiple serial devices sharing a time sliced bus is going to be difficult to make work broadly.

I would go one level higher and ask: what is the use case for 6+ serial ports? Can you use use CAN? Can you offload some of this to a companion computer?

If you did go this route, it would be most clean architecturally at the NuttX level. The ports can be exposed as /dev/tty and used with the standard posix interface.