board: raspberrypi: enable serial communication on Raspberry Pi 5

Enable serial communication through UART port between HDMI ports.

Signed-off-by: Myeonghyeon Park <myeonghyeon@tsnlab.com>
Signed-off-by: Junho Lee <junho@tsnlab.com>
This commit is contained in:
Myeonghyeon Park 2024-03-27 18:19:19 +09:00 committed by Anas Nashif
parent 73f4102ad8
commit 63692c1349
4 changed files with 90 additions and 0 deletions

View file

@ -46,6 +46,9 @@ The Raspberry Pi 5 board configuration supports the following hardware features:
* - GPIO
- :kconfig:option:`CONFIG_GPIO`
- :dtcompatible:`brcm,brcmstb-gpio`
* - UART
- :kconfig:option:`CONFIG_SERIAL`
- :dtcompatible:`arm,pl011`
Not all hardware features are supported yet. See `Raspberry Pi hardware`_ for the complete list of hardware features.
@ -91,6 +94,60 @@ Copy `zephyr.bin` from `build/zephyr` directory to the root directory of the Mic
Insert the Micro SD card and power on the Raspberry Pi 5. And then, the STAT LED will start to blink.
Serial Communication
====================
wiring
------
You will need the following items:
* `Raspberry Pi Debug Probe`_
* JST cable: 3-pin JST connector to 3-pin JST connector cable
* USB cable: USB A male - Micro USB B male
Use the JST cable to connect the Raspberry Pi Debug Probe UART port to the Raspberry Pi 5 UART port between the HDMI ports.
Then connect the Raspberry Pi Debug Probe to your computer with a USB cable.
config.txt
----------
.. code-block:: text
kernel=zephyr.bin
arm_64bit=1
enable_uart=1
uart_2ndstage=1
zephyr.bin
----------
Build an app `samples/hello_world`
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: rpi_5
:goals: build
Copy `zephyr.bin` from `build/zephyr` directory to the root directory of the Micro SD card.
Insert the Micro SD card into your Raspberry Pi 5.
serial terminal emulator
------------------------
When you power on the Raspberry Pi 5, you will see the following output in the serial console:
.. code-block:: text
*** Booting Zephyr OS build XXXXXXXXXXXX ***
Hello World! rpi_5/bcm2712
.. _Raspberry Pi 5 product-brief:
https://datasheets.raspberrypi.com/rpi5/raspberry-pi-5-product-brief.pdf
@ -99,3 +156,6 @@ Insert the Micro SD card and power on the Raspberry Pi 5. And then, the STAT LED
.. _bcm2712-rpi-5.dtb:
https://github.com/raspberrypi/firmware/raw/master/boot/bcm2712-rpi-5-b.dtb
.. _Raspberry Pi Debug Probe:
https://www.raspberrypi.com/products/debug-probe/

View file

@ -21,6 +21,8 @@
chosen {
zephyr,sram = &sram0;
zephyr,console = &uart10;
zephyr,shell-uart = &uart10;
};
leds {
@ -36,3 +38,8 @@
&gio_aon {
status = "okay";
};
&uart10 {
status = "okay";
current-speed = <115200>;
};

View file

@ -3,3 +3,8 @@
CONFIG_ARM64_VA_BITS_40=y
CONFIG_ARM64_PA_BITS_40=y
CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME=y
# Enable serial console.
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

View file

@ -67,5 +67,23 @@
status = "disabled";
};
};
uart10: serial@107d001000 {
compatible = "arm,pl011";
reg = <0x10 0x7d001000 0x200>;
interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL
IRQ_DEFAULT_PRIORITY>;
clocks = <&clk_uart>;
status = "disabled";
};
};
clocks {
clk_uart: clk_uart {
compatible = "fixed-clock";
clock-frequency = <44236800>;
#clock-cells = <0>;
};
};
};