sun8i-v3s.dtsi
uart0_pins_a: uart0@0 {
pins = "PB8", "PB9";
function = "uart0";
};
uart1_pins_a: uart1@0 {
pins = "PE21", "PE22";
function = "uart1";
bias-pull-up;
};
uart2_pins_a: uart2@0 {
pins = "PB0", "PB1";
function = "uart2";
bias-pull-up;
};
sun8i-v3s-licheepi-zero.dts
aliases {
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
spi0 = &spi0;
};
chosen {
stdout-path = "serial1:115200n8";
};
&uart0 {
pinctrl-0 = <&uart0_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&uart1 {
pinctrl-0 = <&uart1_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&uart2 {
pinctrl-0 = <&uart2_pins_a>;
pinctrl-names = "default";
status = "okay";
};
#define CONFIG_BOOTARGS "console=ttyS1,115200 earlyprintk panic=5 rootwait " \
"mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,4M(kernel)ro,-(rootfs) root=31:03 rw rootfstype=jffs2"
以下由 @哇酷小二 2021-02-10 添加
------------------------------------
相关链接:
请问 荔枝派zero V3s主线u-boot 如何修改默认的串口为uart2(PB0/PB1) ?
http://whycan.com/t_1417.html
最近编辑记录 john78 (2018-09-10 17:23:52)
离线
离线
2L是的,3L没改
离线
include/configs/sunxi-common.h
#define CONFIG_CONS_INDEX 1 /* UART0 */
改成:
#define CONFIG_CONS_INDEX 2 /* UART1 */
晕哥,坑还不小。不过改了这,编译就与提示了,gpio_init(void)中没有这个初始化。修改下,就可以了
离线
include/configs/sunxi-common.h
#define CONFIG_CONS_INDEX 1 /* UART0 */
改成:
#define CONFIG_CONS_INDEX 2 /* UART1 */
晕哥,坑还不小。不过改了这,编译就与提示了,gpio_init(void)中没有这个初始化。修改下,就可以了
如何修改呢?可以分享一下吗?
现在可以输出到 UART1 了吗?
离线
include/configs/sunxi-common.h
#define CONFIG_CONS_INDEX 2 /* UART1 */
下面增加
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I)
#define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200"
//还有增加这个引脚的初始化驱动
u-boot/arch/arm/include/asm/arch-sunxi/gpio.h
增加
#define SUN8I_V3S_GPE_UART1 4
u-boot/arch/arm/arch-sunxi/board.c
static int gpio_init(void)
{
增加
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I_V3S)
sunxi_gpio_set_cfgpin(SUNXI_GPE(21), SUN8I_V3S_GPE_UART1);
sunxi_gpio_set_cfgpin(SUNXI_GPE(22), SUN8I_V3S_GPE_UART1);
sunxi_gpio_set_pull(SUNXI_GPE(22), SUNXI_GPIO_PULL_UP);
}
离线
include/configs/sunxi-common.h
#define CONFIG_CONS_INDEX 2 /* UART1 */
下面增加
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I)
#define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200"
//还有增加这个引脚的初始化驱动
u-boot/arch/arm/include/asm/arch-sunxi/gpio.h增加#define SUN8I_V3S_GPE_UART1 4
u-boot/arch/arm/arch-sunxi/board.c
static int gpio_init(void)
{
增加
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I_V3S)
sunxi_gpio_set_cfgpin(SUNXI_GPE(21), SUN8I_V3S_GPE_UART1);
sunxi_gpio_set_cfgpin(SUNXI_GPE(22), SUN8I_V3S_GPE_UART1);
sunxi_gpio_set_pull(SUNXI_GPE(22), SUNXI_GPIO_PULL_UP);
}
感谢分享
离线
卧槽,难怪啊。我今天进了Lichee的BSP系统,想用一下UART1, 才发现有ttyS1, 但是初始化失败, -19错误, 无法使用。
原来也是一个坑啊。
离线
include/configs/sunxi-common.h
#define CONFIG_CONS_INDEX 2 /* UART1 */
下面增加
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I)
#define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200"
//还有增加这个引脚的初始化驱动
u-boot/arch/arm/include/asm/arch-sunxi/gpio.h增加#define SUN8I_V3S_GPE_UART1 4
u-boot/arch/arm/arch-sunxi/board.c
static int gpio_init(void)
{
增加
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I_V3S)
sunxi_gpio_set_cfgpin(SUNXI_GPE(21), SUN8I_V3S_GPE_UART1);
sunxi_gpio_set_cfgpin(SUNXI_GPE(22), SUN8I_V3S_GPE_UART1);
sunxi_gpio_set_pull(SUNXI_GPE(22), SUNXI_GPIO_PULL_UP);
}
关注 V3S uboot 使用uart1需要修改的地方.
目前官方uboot 2020.7 还没有修正。
另外 u-boot/arch/arm/arch-sunxi/board.c 正确路径应该是u-boot/arch/arm/march-sunxi/board.c
离线