The AM1808 SoC has 3 hardware UART controllers. We are also using the PRU to provide 2 additional software UARTs.


Port Use
UART0 Input port 2 UART sensors.
UART1 Input port 1 UART sensors. Also debugging terminal (starts at boot).
UART2 Bluetooth.
PRU0/SUART0 Input port 4 UART sensors.
PRU0/SUART1 Input port 3 UART sensors.

Device Drivers

See the PRU page for info on the PRU UART drivers.

The SoC UARTs are standard UARTs and therefore use the 8250 driver. Both types of UARTs (SoC and PRU) of course implement the tty device class. The interesting part is the LEGOEV3 line discipline that runs on top of the tty driver.

LEGOEV3 Line Discipline

Source: ev3_uart_sensor_ld.c

There are udev rules in place (ev3.rules in conjunction with ev3-uart@.service) that attach the line discipline to a tty (serial port) when a UART sensor is detected on a given input port. When the sensor is removed, the line discipline is detached (process killed).