[RISC-V MCU 应用开发] 全志芯片Tina Linux 修改 UART 引脚、UART端口

[复制链接]
 楼主| 神棍地海棠 发表于 2022-11-7 10:08 | 显示全部楼层 |阅读模式
场景一:同样使用UART0,需要从PF2、PF4改到PE2、PE4
  • 修改sys_config.fex(BOOT0与Uboot的串口)
sys_config.fex 的路径是 device/config/chips/t113/configs/evb1/sys_config.fex 中的 uart_debug_port
修改前:
  1. [uart_para]uart_debug_port = 0uart_debug_tx   = port:PF02<font color="rgb(232, 191, 106)"><3></font><font color="rgb(232, 191, 106)"><1></font><font color="rgb(232, 191, 106)"><default></font><font color="rgb(232, 191, 106)"><default></font>uart_debug_rx   = port:PF04<font color="rgb(232, 191, 106)"><3></font><font color="rgb(232, 191, 106)"><1></font><font color="rgb(232, 191, 106)"><default></font><font color="rgb(232, 191, 106)"><default></font>

修改后
  1. [uart_para]uart_debug_port = 0uart_debug_tx   = port:PE02<font color="rgb(232, 191, 106)"><6></font><font color="rgb(232, 191, 106)"><1></font><font color="rgb(232, 191, 106)"><default></font><font color="rgb(232, 191, 106)"><default></font>uart_debug_rx   = port:PE03<font color="rgb(232, 191, 106)"><6></font><font color="rgb(232, 191, 106)"><1></font><font color="rgb(232, 191, 106)"><default></font><font color="rgb(232, 191, 106)"><default></font>

其中<3>改为<6> 是查阅数据手册中 PE2、PE3 的UART0是 Function6 得知的
1656399622885-a858d4ee-716b-4fd6-ba8d-d94265331d66-%E5%9B%BE%E7%89%871.png
    1. port:PE02    <font color="rgb(232, 191, 106)"><6></font><font color="rgb(232, 191, 106)"><1></font><font color="rgb(232, 191, 106)"><default></font><font color="rgb(232, 191, 106)"><default></font>        ^     ^       PE2脚  引脚功能6(查阅datasheet得知)

    修改设备树(Linux使用的串口输出)
路径:device/config/chips/t113/configs/evb1/board.dts
修改前
  1. <font color="rgb(109, 156, 190)">uart0_pins_a:</font> uart0_pins<a href="home.php?mod=space&uid=2514928" target="_blank">@0</a> {  <font color="rgb(165, 194, 97)">/* For EVB1 board */</font>        pins = <font color="rgb(165, 194, 97)">"PF2"</font>, <font color="rgb(165, 194, 97)">"PF4"</font>;        function = <font color="rgb(165, 194, 97)">"uart0"</font>;        drive-strength = <<font color="rgb(165, 194, 97)">10</font>>;        allwinner,muxsel = <<font color="rgb(165, 194, 97)">3</font>>;        bias-pull-up;};<font color="rgb(109, 156, 190)">uart0_pins_b:</font> uart0_pins<a href="home.php?mod=space&uid=2514798" target="_blank">@1</a> {  <font color="rgb(165, 194, 97)">/* For EVB1 board */</font>        pins = <font color="rgb(165, 194, 97)">"PF2"</font>, <font color="rgb(165, 194, 97)">"PF4"</font>;        function = <font color="rgb(165, 194, 97)">"gpio_in"</font>;};

修改后
  1. <font color="rgb(109, 156, 190)">uart0_pins_a:</font> uart0_pins[url=home.php?mod=space&uid=2514928]@0[/url] {  <font color="rgb(165, 194, 97)">/* For EVB1 board */</font>        pins = <font color="rgb(165, 194, 97)">"PE2"</font>, <font color="rgb(165, 194, 97)">"PE3"</font>;        function = <font color="rgb(165, 194, 97)">"uart0"</font>;        drive-strength = <<font color="rgb(165, 194, 97)">10</font>>;        allwinner,muxsel = <<font color="rgb(165, 194, 97)">6</font>>;        bias-pull-up;};<font color="rgb(109, 156, 190)">uart0_pins_b:</font> uart0_pins[url=home.php?mod=space&uid=2514798]@1[/url] {  <font color="rgb(165, 194, 97)">/* For EVB1 board */</font>        pins = <font color="rgb(165, 194, 97)">"PE2"</font>, <font color="rgb(165, 194, 97)">"PE3"</font>;        function = <font color="rgb(165, 194, 97)">"gpio_in"</font>;};

豌豆爹 发表于 2022-11-7 15:53 来自手机 | 显示全部楼层
使用代码框来敲代码把
豌豆爹 发表于 2022-11-7 15:54 来自手机 | 显示全部楼层
整个代码显得一团糟
e_007 发表于 2022-11-8 17:13 | 显示全部楼层
本帖最后由 e_007 于 2022-11-8 18:19 编辑

....
您需要登录后才可以回帖 登录 | 注册

本版积分规则

284

主题

292

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部