Raspberry Pi has UART interface on GPIO pins 14 and 15.
FreeBSD uses it as serial console.
It outputs system messages and provides terminal mode on it.
This is good for first time setup and for debugging.
But if you plan to use this interface for connection to any special device especially in a standalone project, you need to liberate this interface.
Here is a description how to do this.
UART interface in the Raspberry Pi in the FreeBSD shown as /dev/ttyu0
First step is remove getty(8) from /dev/ttyu0
To do this we need just to change “on” to “off” for the ttyu0 in the file /etc/ttys:
After that we can use /dev/ttyu0 with different programms to communicate with our devices.
For liberation UART interface from system messages we need to change Device tree source file.
The device tree source (DTS) is a text file which describes hardware resources of a computer system in a human-readable form.
We need to commented out strings 377 and 378 in the file /usr/src/sys/boot/fdt/dts/arm/rpi.dts:
After changing this file we need to compile Device tree blob (DTB) file and to copy it in our boot environment.
To do that we need to run this commands:
# cd /usr/src/sys/tools/fdt
# setenv MACHINE arm
# ./make_dtb.sh /usr/src/sys /usr/src/sys/boot/fdt/dts/arm/rpi.dts rpi.dtb
# cp /boot/msdos/rpi.dtb /boot/msdos/rpidtb.old
# cp rpi.dtb /boot/msdos
New dtb file less than old one, but it works.
Unfortunately that’s not all.
We still have some messages from U-Boot on the UART interface:
I tried to change files /boot/msdos/config.txt, /boot/msdos/cmdline.txt and /boot/msdos/uenv.txt, but nothing helps.