UART on GPIO header

Contents


About

There are two pins on the GPIO header that can be used as UART. They are used by the PiLocoBuffer board in order to exchange LocoNet messages between RasPi and AVR

The confusion

The different processors built into RasPi have two different serial interfaces. The RasPi 4 has even more, but that does not matter now. Those two serial interfaces (“PL011” and “mini UART”) are mapped differently to the GPIO header, depending whether the RasPi has bluetooth built in and whether this is enabled. LbServer has proven to work with both types of serial interface, so it is not worth trying to control which interface is connected to the GPIO header. Always use the symbolic link /dev/serial0, which points to the serial interface that is routed to the GPIO header.

Enable interface, disable console

The configuration tool raspi-config can be used to enable the serial interface in the “5 Interface Options” menu. You have to say “no” to the shell login and “yes” to enable the serial hardware port. This step can be automated with Martins master makefile.

Rights to access the device

By default, the serial port device has access rights for the super user and group dailout. We launch LbServer as a service as a special user named lbserver that is in group dailout, so it has access.

References

For more information about the UARTs used in different hardware versions see