120
27 Enable UART
● UART is a more commonly used communication protocol between devices. Using UART, you can allow MCUs
such as Arduino, STM32, or ESP32 to communicate with the Raspberry Pi, which can make your robot more powerful.
●However, for some Raspberry Pis, the UART that is enabled by default is not a full-featured UART, so you need to
refer to the following steps to enable the full-featured UART. The following parts are from the official documentation of
the Raspberry Pi The Raspberry Pi UARTs.
●The SoCs used on the Raspberry Pis have two built-in UARTs, a PL011 and a mini UART. They are implemented
using different hardware blocks, so they have slightly different characteristics. However, both are 3.3V devices, which
means extra care must be taken when connecting up to an RS232 or other system that utilises different voltage levels.
An adapter must be used to convert the voltage levels between the two protocols. Alternatively, 3.3V USB UART
adapters can be purchased for very low prices.
● By default, on Raspberry Pis equipped with the wireless/Bluetooth module (Raspberry Pi 3 and Raspberry Pi
Zero W), the PL011 UART is connected to the Bluetooth module, while the mini UART is used as the primary UART and
will have a Linux console on it. On all other models, the PL011 is used as the primary UART.
●In Linux device terms, by default, /dev/ttyS0 refers to the mini UART, and /dev/ttyAMA0 refers to the PL011. The
primary UART is the one assigned to the Linux console, which depends on the Raspberry Pi model as described above.
There are also symlinks:
/dev/serial0, which always refers to the primary UART (if enabled), and /dev/serial1, which similarly always refers
to the secondary UART (if enabled).
27.1 Mini UART and CPU Core Frequency
●The baud rate of the mini UART is linked to the core frequency of the VPU on the VC4 GPU. This means that, as
the VPU frequency governor varies the core frequency, the baud rate of the mini UART also changes. This makes the
mini UART of limited use in the default state. By default, if the mini UART is selected for use as the primary UART, it will
be disabled. To enable it, add enable_uart=1 to config.txt. This will also fix the core frequency to 250MHz (unless
force_turbo is set, when it will be fixed to the VPU turbo frequency). When the mini UART is not the primary UART, for
example you are using it to connect to the Bluetooth controller, you must add core_freq=250 to config.txt, otherwise
the mini UART will not work.
● The default value of the enable_uart flag depends on the actual roles of the UARTs, so that if ttyAMA0 is
assigned to the Bluetooth module, enable_uart defaults to 0. If the mini UART is assigned to the Bluetooth module,
then enable_uart defaults to 1. Note that if the UARTs are reassigned using a Device Tree Overlay (see below),
enable_uart defaults will still obey this rule.
27.2 Disabling Linux's Use of Console UART
●In a default install of Raspbian, the primary UART (serial0) is assigned to the Linux console. Using the serial port
Need help?
Do you have a question about the AWR Adeept Wheeled Robot and is the answer not in the manual?