Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    全志芯片Tina Linux 修改 UART 引脚、UART端口

    Linux
    11
    15
    12172
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      YterAA LV 7 last edited by xiaowenge

      场景一:同样使用UART0,需要从PF2、PF4改到PE2、PE4

      1. 修改sys_config.fex(BOOT0与Uboot的串口)

      sys_config.fex 的路径是 device/config/chips/t113/configs/evb1/sys_config.fex 中的 uart_debug_port

      修改前:

      [uart_para]
      uart_debug_port = 0
      uart_debug_tx   = port:PF02<3><1><default><default>
      uart_debug_rx   = port:PF04<3><1><default><default>
      

      修改后

      [uart_para]
      uart_debug_port = 0
      uart_debug_tx   = port:PE02<6><1><default><default>
      uart_debug_rx   = port:PE03<6><1><default><default>
      

      其中<3>改为<6> 是查阅数据手册中 PE2、PE3 的UART0是 Function6 得知的
      a858d4ee-716b-4fd6-ba8d-d94265331d66-图片1.png

      port:PE02    <6><1><default><default>
              ^     ^
             PE2脚  引脚功能6(查阅datasheet得知)
      
      1. 修改设备树(Linux使用的串口输出)

      路径:device/config/chips/t113/configs/evb1/board.dts

      修改前

      uart0_pins_a: uart0_pins@0 {  /* For EVB1 board */
      	pins = "PF2", "PF4";
      	function = "uart0";
      	drive-strength = <10>;
      	allwinner,muxsel = <3>;
      	bias-pull-up;
      };
      
      uart0_pins_b: uart0_pins@1 {  /* For EVB1 board */
      	pins = "PF2", "PF4";
      	function = "gpio_in";
      };
      

      修改后

      uart0_pins_a: uart0_pins@0 {  /* For EVB1 board */
      	pins = "PE2", "PE3";
      	function = "uart0";
      	drive-strength = <10>;
      	allwinner,muxsel = <6>;
      	bias-pull-up;
      };
      
      uart0_pins_b: uart0_pins@1 {  /* For EVB1 board */
      	pins = "PE2", "PE3";
      	function = "gpio_in";
      };
      
      D 1 Reply Last reply Reply Quote Share 9
      • Y
        YterAA LV 7 last edited by YuzukiTsuru

        场景二:使用UART3,需要从UART0改为UART3(PB6,PB7)

        1. 修改sys_config.fex(BOOT0与Uboot的串口)

        sys_config.fex 的路径是 device/config/chips/t113/configs/evb1/sys_config.fex 中的 uart_debug_port

        修改前:

        [uart_para]
        uart_debug_port = 0
        uart_debug_tx   = port:PF02<3><1><default><default>
        uart_debug_rx   = port:PF04<3><1><default><default>
        

        修改后

        [uart_para]
        uart_debug_port = 3
        uart_debug_tx   = port:PB06<7><1><default><default>
        uart_debug_rx   = port:PB07<7><1><default><default>
        
        1. 修改设备树(Linux使用的串口输出)

        路径:device/config/chips/t113/configs/evb1/board.dts

        修改前

        uart3_pins_a: uart3_pins@0 {
        	pins = "PC6", "PC7";
        	function = "uart0";
        	drive-strength = <10>;
        	allwinner,muxsel = <4>;
        	bias-pull-up;
        };
        
        uart3_pins_b: uart3_pins@1 {
        	pins = "PC6", "PC7";
        	function = "gpio_in";
        };
        
        &uart0 {
        	pinctrl-names = "default", "sleep";
        	pinctrl-0 = <&uart0_pins_a>;
        	pinctrl-1 = <&uart0_pins_b>; 
        	status = "okay"; 
        };
        
        &uart3 {
        	pinctrl-names = "default", "sleep";
        	pinctrl-0 = <&uart3_pins_a>;
        	pinctrl-1 = <&uart3_pins_b>;
        	status = "disabled"; 
        };
        

        修改后

        uart3_pins_a: uart3_pins@0 {
        	pins = "PB6", "PB7";
        	function = "uart0";
        	drive-strength = <10>;
        	allwinner,muxsel = <7>;
        	bias-pull-up;
        };
        
        uart3_pins_b: uart3_pins@1 {
        	pins = "PB6", "PB7";
        	function = "gpio_in";
        };
        
        &uart0 {
        	pinctrl-names = "default", "sleep";
        	pinctrl-0 = <&uart0_pins_a>;
        	pinctrl-1 = <&uart0_pins_b>; 
        	status = "disabled";                               # 关闭UART0
        };
        
        &uart3 {
        	pinctrl-names = "default", "sleep";
        	pinctrl-0 = <&uart3_pins_a>;
        	pinctrl-1 = <&uart3_pins_b>;
        	status = "okay";                                   # 开启UART3
        };
        
        1. 修改UBOOT CONSOLE INDEX

        路径:brandy/brandy-2.0/u-boot-2018/configs/sun8iw20p1_defconfig
        增加下列内容

        CONFIG_SPECIFY_CONSOLE_INDEX=y
        CONFIG_CONS_INDEX=4                            # UART 3+1 = 4 
        
        1. 修改启动bootargs

        路径:device/config/chips/t113/configs/evb1/env.cfg

        修改前

        earlyprintk=sunxi-uart,0x02500000
        initcall_debug=0
        console=ttyS0,115200
        

        修改后
        earlyprintk=sunxi-uart,0x02500000 需要修改为 UART3 的地址,查阅手册可知为 0x02500C00
        12849b33-3786-417e-b2fe-7736c04d4b38-image.png

        earlyprintk=sunxi-uart,0x02500C00
        initcall_debug=0
        console=ttyS3,115200
        

        注意 ARM 平台还需要设置Kernel,如下:

        make kernel_menuconfig 找到 Kernel low-level debugging functions,修改寄存器地址

        79bf0af2-3b08-48fb-810d-fc2b492209d0-image.png

        RISC-V 不需要此操作

        1 Reply Last reply Reply Quote Share 8
        • jinxiangwzh
          jinxiangwzh LV 7 last edited by

          学习了,感谢您的高质量输出

          radxiaohe 1 Reply Last reply Reply Quote Share 1
          • Referenced by  whycan whycan 
          • Referenced by  J jr_online 
          • Referenced by  J jr_online 
          • Referenced by  J jr_online 
          • Referenced by  B buyadong 
          • how0723
            how0723 LV 5 last edited by

            非常不错,解决了我的问题

            1 Reply Last reply Reply Quote Share 0
            • Referenced by  H Honey130602 
            • Referenced by  H Honey130602 
            • Referenced by  H Honey130602 
            • Referenced by  J jr_online 
            • Y
              YterAA LV 7 last edited by

              注意 ARM 平台还需要设置Kernel,如下:

              make kernel_menuconfig 找到 Kernel low-level debugging functions,修改寄存器地址

              79bf0af2-3b08-48fb-810d-fc2b492209d0-image.png

              RISC-V 不需要此操作

              (之前忘记说了,现在补上

              1 Reply Last reply Reply Quote Share 1
              • K
                kelsey LV 6 last edited by

                为何在场景二中,从UART0改为UART3
                2bf3fd41-def9-4428-8319-389fa7c24992-image.png
                uart_debug_port 并不需要修改呢????

                Y 1 Reply Last reply Reply Quote Share 0
                • Y
                  YterAA LV 7 @kelsey last edited by

                  @kelsey 写错了已修改

                  K 1 Reply Last reply Reply Quote Share 0
                  • K
                    kelsey LV 6 @YterAA last edited by

                    @yteraa 哈哈哈,好的

                    1 Reply Last reply Reply Quote Share 0
                    • D
                      dream LV 6 @YterAA last edited by

                      @yteraa 收藏一波,谢谢楼主分享

                      1 Reply Last reply Reply Quote Share 0
                      • L
                        one001 LV 4 last edited by

                        我在R11芯片上通过修改下面内容从uart0换到uart1,kernel是3.4的,但是呢,uart1打印kernel启动2秒多后就卡住了似乎,uart1没反应了,不知道是不是还有哪里没修改的,而且kernel3.4版本没找到修改调试口的地方,请问可以帮我解决下吗,这是我发的贴子,R11 DEBUG uart0 换 uart1

                        1 Reply Last reply Reply Quote Share 0
                        • L
                          one001 LV 4 last edited by

                          @YterAA 帮我看下我的这个问题哦 链接文本

                          1 Reply Last reply Reply Quote Share 0
                          • Referenced by  K kw___ 
                          • Referenced by  K kw___ 
                          • Referenced by  J jr_online 
                          • Referenced by  J jr_online 
                          • Referenced by  whycan whycan 
                          • Referenced by  C cruise33 
                          • Referenced by  A axw_fae 
                          • G
                            gonboy LV 5 last edited by

                            按照文档配置。 uart0 改为 uart3 后, kernel 的日志无法打印。无法进入控制台。

                            1 Reply Last reply Reply Quote Share 0
                            • radxiaohe
                              radxiaohe LV 4 @jinxiangwzh last edited by

                              @jinxiangwzh 在 全志芯片Tina Linux 修改 UART 引脚、UART端口 中说:

                              学习了,感谢您的高质量输出

                              1 Reply Last reply Reply Quote Share 0
                              • H
                                hubbell LV 3 last edited by

                                教程不错,学习了。
                                uart debug配置搞了很久。

                                1 Reply Last reply Reply Quote Share 1
                                • aldfaaa
                                  whycan矿工-小叶 LV 7 last edited by

                                  挖一个古早期的修改UART帖😊
                                  D1s分别在Tina Linx, Melis修改调试串口实录
                                  https://bbs.aw-ol.com/topic/3194/share/1

                                  1 Reply Last reply Reply Quote Share 0
                                  • Referenced by  W whycanservice2 
                                  • Referenced by  W whycanservice2 
                                  • Referenced by  W whycanservice2 
                                  • Referenced by  C cwj1986521 
                                  • Referenced by  whycan whycan 
                                  • Referenced by  KunYi KunYi 
                                  • 1 / 1
                                  • First post
                                    Last post

                                  Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                                  行为准则 | 用户协议 | 隐私权政策