• Recent
  • Wiki
  • Github
  • 百度网盘
  • Onedrive
  • Official
  • Shop
  • Register
  • Login
  • Register
  • Login
  • Search
  • Recent
  • Wiki
  • Github
  • 百度网盘
  • Onedrive
  • Official
  • Shop

CoolPi 4B硬件扩展二:Serial port

Hardware
8
18
5.4k
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.
  • G
    george last edited by george Jan 28, 2023, 6:33 AM Nov 9, 2022, 12:41 AM

    串口位置

    下表罗列了40PIN连接器可以用做UART功能的引脚,目前除了debug串口以外还可以扩展5路独立串口。最大波特率1.5M。IO电平是TTL 3.3V。注意:串口号和实际系统的节点不是一一对应,实际操作需要按照表格对应的设备节点。

    序号 端口定义 描述 IO电平 设备节点
    29 UART0_TX_M2 UART0 发送 TTL 3.3V /dev/ttyS6
    31 UART0_RX_M2 UART0 接收 TTL 3.3V /dev/ttyS6
    33 UART3_TX_M2 UART3 发送 TTL 3.3V /dev/ttyS3
    35 UART3_RX_M2 UART3 接收 TTL 3.3V /dev/ttyS3
    19 UART4_RX_M2 UART4 接收 TTL 3.3V /dev/ttyS4
    23 UART4_TX_M2 UART4 发送 TTL 3.3V /dev/ttyS4
    16 UART6_TX_M1 UART6 发送 TTL 3.3V /dev/ttyS2
    18 UART6_RX_M1 UART6 接收 TTL 3.3V /dev/ttyS2
    24 UART7_RX_M2 UART7 接收 TTL 3.3V /dev/ttyS7
    26 UART7_TX_M2 UART7 发送 TTL 3.3V /dev/ttyS7

    DTS配置

    用户需要使用哪个串口在DTS打开对应节点即可,status = "okay"代表开启,status = "disabled"代表关闭。注意不使用UART功能确保对应节点的status是disabled状态,否则可能会导致其它功能异常。

    &uart0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart0m2_xfer>;
    	status = "okay";
    };
    
    &uart3 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart3m2_xfer>;
    	status = "okay";
    };
    
    &uart4 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart4m2_xfer>;
    	status = "okay";
    };
    
    &uart6 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart6m1_xfer>;
    	status = "okay";
    };
    
    &uart7 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart7m2_xfer>;
    	status = "okay";
    };
    

    shell测试命令

    功能测试采用回环测试(对应串口的TX RX信号短接)。

    stty -F /dev/ttyS6 raw speed 115200 //配置PIN29 PIN31对应的串口波特率为115200
    echo "hello world" > /dev/ttyS6 //发送字符串
    cat /dev/ttyS6 //接收字符串
    
    

    RS232电路

    RS232.png
    SIT3232EEAE.PDF

    隔离485电路

    485.png
    UTRS485G.PDF
    CA-IS3722LS.PDF
    B0505S-1W.PDF

    1 Reply Last reply Reply Quote 1
    • Locked by  G george Nov 9, 2022, 4:38 AM
    • Unlocked by  G george Nov 9, 2022, 4:56 AM
    • D
      dreamer last edited by Jan 17, 2023, 6:15 AM

      It seems that the DTB file has changed a lot in the 20.04 ubuntu image. I can only find uart3-m1-xfer instead of the needed uart3-m2-xfer in DTS file converted from rk3588s-cp4.dtb. What should I do in order to use uart3 under this circumstance?

      		uart2 {
      
      			uart2m0-xfer {
      				rockchip,pins = <0x00 0x0e 0x0a 0x167 0x00 0x0d 0x0a 0x167>;
      				phandle = <0x136>;
      			};
      		};
      
      		uart3 {
      
      			uart3m1-xfer {
      				rockchip,pins = <0x03 0x0e 0x0a 0x167 0x03 0x0d 0x0a 0x167>;
      				phandle = <0x137>;
      			};
      		};
      
      		uart4 {
      
      			uart4m1-xfer {
      				rockchip,pins = <0x03 0x18 0x0a 0x167 0x03 0x19 0x0a 0x167>;
      				phandle = <0x138>;
      			};
      		};
      
      		uart5 {
      
      			uart5m1-xfer {
      				rockchip,pins = <0x03 0x15 0x0a 0x167 0x03 0x14 0x0a 0x167>;
      				phandle = <0x139>;
      			};
      		};
      
      大法师 1 Reply Last reply Jan 17, 2023, 7:07 AM Reply Quote 0
      • 大法师
        大法师 @dreamer last edited by Jan 17, 2023, 7:07 AM

        @dreamer
        657ddc8d-1873-4540-8872-cf8d5a22a1da-1673939130990.png

        uart2 node is used for console and uart9 node is used for bluetooth.

        jack@cool-pi.com

        D 1 Reply Last reply Jan 17, 2023, 7:32 AM Reply Quote 0
        • D
          dreamer @大法师 last edited by Jan 17, 2023, 7:32 AM

          @大法师 Many thanks for your reply, but unoccupied serial ports accessible from GPIOs include uart3,6. There left only uart6 if uart3 can't be functional. Is it possible to activate uart3-m2-xfer?
          1affb7dc-1400-4c8c-8684-7d23e5bb2de3-image.png

          1 Reply Last reply Reply Quote 0
          • topic:timeago_later,9 months
          • A
            AugustRobot_Zou last edited by Oct 11, 2023, 11:44 AM

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • A
              AugustRobot_Zou last edited by AugustRobot_Zou Oct 11, 2023, 1:07 PM Oct 11, 2023, 12:44 PM

              有办法把console关闭吗?使用uart2-ttyS0作为一路普通串口

              G 1 Reply Last reply Oct 12, 2023, 5:44 AM Reply Quote 0
              • G
                george @AugustRobot_Zou last edited by Oct 12, 2023, 5:44 AM

                @AugustRobot_Zou
                可以,但是比较麻烦,需要改loader uboot kernel,现在扩展口上面串口不够用吗?

                A S 2 Replies Last reply Jul 9, 2024, 11:44 AM Reply Quote 0
                • A
                  AugustRobot_Zou @george last edited by Oct 12, 2023, 6:34 AM

                  @george 目前是刚好够用的,我以为跟其他串口一样改一下内核设备树就能多一个备用串口,如果太麻烦就算了暂时不用,别引出其他bug了。

                  大法师 1 Reply Last reply Oct 12, 2023, 7:49 AM Reply Quote 0
                  • 大法师
                    大法师 @AugustRobot_Zou last edited by Oct 12, 2023, 7:49 AM

                    @AugustRobot_Zou 如果不介意开机启动阶段的一些串口输出,可以直接修改配置参数,把ttyS0当做普通串口使用。

                    /boot/firmware/extlinux/extlinux.conf

                    console=ttyS0,115200
                    改为
                    console=tty0
                    

                    jack@cool-pi.com

                    S 1 Reply Last reply Jul 9, 2024, 1:07 PM Reply Quote 0
                    • 阿
                      阿里 last edited by Oct 16, 2023, 2:08 AM

                      板上I/O口的对应哪个呀,都没标注出来

                      阿 1 Reply Last reply Oct 16, 2023, 2:09 AM Reply Quote 0
                      • 阿
                        阿里 @阿里 last edited by Oct 16, 2023, 2:09 AM

                        系统上显示的为0,1,2

                        G 1 Reply Last reply Oct 16, 2023, 2:22 AM Reply Quote 0
                        • G
                          george @阿里 last edited by Oct 16, 2023, 2:22 AM

                          @阿里
                          wiki上有原理图和PCB也有标识第一脚位置,数一下就可以确定了。

                          1 Reply Last reply Reply Quote 0
                          • topic:timeago_later,5 months
                          • 银
                            银河铁道 last edited by Feb 28, 2024, 9:37 AM

                            请问一下,我这边看完了wiki,我目前理解是,如果从网盘中下载下来的镜像,仅开启了uart2、9、6。其中uart2也就是ttyS0作为debug口。uart9也就是ttyS1和uart6也就是ttyS2作为普通串口。

                            但是我有如下问题:

                            1. 我没有找到uart9(ttyS1)对应的外部引脚,从电路图上看似乎是用来做蓝牙的串口了?
                            2. 如果我希望不改动debug口的情况下,引脚上有至少两个可用串口,是否我需要重写dts,然后重编内核,再打包镜像?我对bsp不太熟,希望大佬指导一下。
                            G J 2 Replies Last reply Feb 28, 2024, 3:56 PM Reply Quote 0
                            • G
                              george @银河铁道 last edited by Feb 28, 2024, 9:43 AM

                              @银河铁道
                              修改DTS配置,然后把编译生成的dtb文件拷贝到boot分区重启即可。

                              1 Reply Last reply Reply Quote 0
                              • J
                                jack_admin @银河铁道 last edited by Feb 28, 2024, 3:56 PM

                                @银河铁道 said in CoolPi 4B硬件扩展二:Serial port:

                                请问一下,我这边看完了wiki,我目前理解是,如果从网盘中下载下来的镜像,仅开启了uart2、9、6。其中uart2也就是ttyS0作为debug口。uart9也就是ttyS1和uart6也就是ttyS2作为普通串口。

                                但是我有如下问题:

                                1. 我没有找到uart9(ttyS1)对应的外部引脚,从电路图上看似乎是用来做蓝牙的串口了?
                                2. 如果我希望不改动debug口的情况下,引脚上有至少两个可用串口,是否我需要重写dts,然后重编内核,再打包镜像?我对bsp不太熟,希望大佬指导一下。

                                ttyS1用作蓝牙通信

                                1 Reply Last reply Reply Quote 0
                                • topic:timeago_later,4 months
                                • S
                                  santu @george last edited by Jul 9, 2024, 11:44 AM

                                  @george 请问有相关教程可以参考吗?

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    santu @大法师 last edited by Jul 9, 2024, 1:07 PM

                                    @大法师 改完之后重启,会生效。但是重新上电就又不行了,还得带电重启一次 请问这可能是怎么造成的呢

                                    G 1 Reply Last reply Jul 9, 2024, 2:00 PM Reply Quote 0
                                    • G
                                      george @santu last edited by Jul 9, 2024, 2:00 PM

                                      @santu
                                      重启和重新上电以后运行如下命令发出来

                                      ls /dev/ttyS*
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • 1 / 1
                                      15 out of 18
                                      • First post
                                        15/18
                                        Last post