rk3399修改调试串口
Posted tccxy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rk3399修改调试串口相关的知识,希望对你有一定的参考价值。
rk3399修改调试串口
rk3399可以修改调试串口为任意板载的uart
由于厂家的一级loader没有开源,因此更改调试串口后,一级loader的打印无法再看到了
手里面有一块rockpi4b的板子
其pin脚如下,从官方的uart改为下图中的uart4
官方支持的bsp代码
https://github.com/radxa/rockchip-bsp.git
首先修改uboot的代码
git diff
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 8000614..4c44548 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -11,7 +11,7 @@
};
};
-&uart2 {
+&uart4 {
clock-frequency = <24000000>;
:...skipping...
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 8000614..4c44548 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -11,7 +11,7 @@
};
};
-&uart2 {
+&uart4 {
clock-frequency = <24000000>;
u-boot,dm-pre-reloc;
status = "okay";
diff --git a/arch/arm/dts/rockpi-4b-linux.dts b/arch/arm/dts/rockpi-4b-linux.dts
old mode 100644
new mode 100755
index f28fa8f..46a147b
--- a/arch/arm/dts/rockpi-4b-linux.dts
+++ b/arch/arm/dts/rockpi-4b-linux.dts
@@ -22,7 +22,7 @@
};
chosen {
- stdout-path = &uart2;
+ stdout-path = &uart4;
u-boot,spl-boot-order = &sdhci, &sdmmc;
};
diff --git a/configs/rock-pi-4b-rk3399_defconfig b/configs/rock-pi-4b-rk3399_defconfig
index f0292e8..5a4b2e1 100644
--- a/configs/rock-pi-4b-rk3399_defconfig
+++ b/configs/rock-pi-4b-rk3399_defconfig
@@ -14,7 +14,7 @@ CONFIG_DEBUG_UART=y
CONFIG_FIT=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
-CONFIG_BOOTDELAY=1
+CONFIG_BOOTDELAY=5
# CONFIG_DISPLAY_CPUINFO is not set
CONFIG_android_BOOTLOADER=y
CONFIG_SPL_STACK_R=y
@@ -71,9 +71,9 @@ CONFIG_RAM=y
CONFIG_SPL_RAM=y
CONFIG_DM_RESET=y
CONFIG_BAUDRATE=1500000
-CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_BASE=0xFF370000
CONFIG_DEBUG_UART_CLOCK=24000000
-CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_DEBUG_UART_SHIFT=4
CONFIG_SYSRESET=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
linux kernel更改如下
git diff
diff --git a/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf b/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf
index 024fe76..41d3d48 100644
--- a/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf
+++ b/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf
@@ -21,7 +21,7 @@ intfc:i2c7=off
#intfc:dtoverlay=at24c02
# Serial console on UART2
-intfc:dtoverlay=console-on-ttyS2
+intfc:dtoverlay=console-on-ttyS4
# Serial console on UART4
#intfc:dtoverlay=console-on-ttyS4
diff --git a/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi b/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi
index 1a18fc4..e6ea618 100644
--- a/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi
@@ -54,13 +54,13 @@
fiq_debugger: fiq-debugger {
status = "disabled";
compatible = "rockchip,fiq-debugger";
- rockchip,serial-id = <2>;
+ rockchip,serial-id = <4>;
rockchip,signal-irq = <182>;
rockchip,wake-irq = <0>;
rockchip,irq-mode-enable = <1>; /* If enable uart uses irq instead of fiq */
rockchip,baudrate = <1500000>; /* Only 115200 and 1500000 */
pinctrl-names = "default";
- pinctrl-0 = <&uart2c_xfer>;
+ pinctrl-0 = <&uart4_xfer>;
};
vcc1v8_s0: vcc1v8-s0 {
@@ -750,7 +750,7 @@
};
&uart4 {
- status = "disabled";
+ status = "okay";
};
上板子调试完全可以,只是缺少了一级loader的打印
以上是关于rk3399修改调试串口的主要内容,如果未能解决你的问题,请参考以下文章
RK3399驱动开发 | 03 - WK2124串口芯片驱动调试
RK3399驱动开发 | 03 - WK2124串口芯片驱动调试
RK3399平台开发系列讲解(USB转串口)5.49/dev/ttyUSB 修改串口名