Raspberry Pi 4 w/ Raspbian
Bottom line, everything you need you can probably find in the Raspberry Pi documentation. This material aims to answer some of the questions that I've found myself asking to prevent the need to pull out the Raspberry Pi Bible.
Bootup UART Debugging
enable_uart=1
There are several options that enable UART output from the bootup of the Raspberry Pi. The easiest is the config.txt
option enable_uart=1
. If you add this option to your RPi4's config.txt
file, the bootloader will enable the mini UART the operates on pins 14(tx) and 15(rx). RPi UART Pinouts
Note: This option alone only enables the UART firmware, any software or kernels loaded need to know to use the UART as well. For example, you need to include console=serial0,115200
in the linux kernel command line.
uart_2ndstage=1
If there is no kernel or UART out from the Raspberry Pi application, enable_uart=1
will produce no output by itself. By adding uart_2ndstage=1
to the RPi4's config.txt
file, you'll get output generated by the start4.elf bootloader program. This will show messages about the code flow that involves loading recovery binaries and the final kernel image.
BOOT_UART=1
The lowest level UART configuration commonly available is stored in the EEPROM of the RPi4. This option produces the UART output associated with the VideoCore bootup process. Note: Other RPi models store this value in bootcode.bin
.
On the RPi4, in Raspbian, you can find a stable EEPROM binary in /lib/firmware/raspberrypi/bootloader/stable/
. Once you've located the pieeprom.bin file to use, copy it to another location (e.g. /boot). To update the configuration, use the following command model (its not a copy paste thing!):
# Dump the current settings
sudo rpi-eeprom-config pieeprom-nouart.bin > bootconf.txt
# Modify the bootconf.txt for your needs (e.g. Change BOOT_UART=0 or BOOT_UART=1)
vi bootconf.txt
# Apply the updated settings to new eeprom file.
sudo rpi-eeprom-config --out pieeprom-uart.bin --config bootconf.txt pieeprom-nouart.bin
# Stage the updated eeprom file to the EEPROM.
sudo rpi-eeprom-update -d -f pieeprom-uart.bin
# Apply the updated EEPROM settings by rebooting.
sudo reboot
Note: you can optionally view the bootloader configuration with vcgencmd bootloader_config
.
Other config.txt Settings
Official Raspberry Pi config.txt Documentation