串口调试
如果正在进行 u-boot 或内核开发,usb串口适配器(usb 转串口ttl 适配器的简称)对于检查系统启动日志非常有用,特别是在没有图形桌面显示的情况下。
配置串口调试
由于用于串口调试的uart2与蓝牙所使用的串口复用,所以官方发布的固件无法使用串口调试。如果使用串口调试,蓝牙就无法正常使用,需要使用到串口调试请进行如下修改:
linux配置串口调试
配置串口调试前,首先需要《编译 linux 固件》,然后请进行如下修改:
打开配置文件kernel/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts。
串口调试的相关配置节点:
fiq-debugger { status = disabled; }; ... &uart2 { dma-names = tx, rx; status = okay; };
修改为:
fiq-debugger { status = okay; }; ... &uart2 { dma-names = tx, rx; status = disabled; };
编译内核,然后下载固件。
android配置串口调试
配置串口调试前,首先需要《编译 android 固件》,然后请进行如下修改:
打开配置文件kernel/arch/arm64/boot/dts/rk3328-roc-pc-port.dtsi。
串口调试的相关配置节点:
fiq-debugger { status = disabled; }; ... &uart_dbg { status = okay; dma-names = tx,rx; };
修改为:
fiq-debugger { status = okay; }; ... &uart_dbg { status = disabled; dma-names = tx,rx; };
编译内核,然后下载固件。
准备 usb 串口适配器
选择 usb 串口适配器
roc-rk3328-pc 的 uart 调试口默认使用1,500,000波特率和 ttl 电平。
一些串口适配器不能支持如此高的波特率。因此在购买之前,请确保它符合要求并有可用的驱动。参考在线商城上带 cp2104 芯片的 usb 转串口适配器。
连接适配器和调试口
用三根线将 tx/rx/gnd 引脚分别连接在一起:
如果在使用某些适配器时串口控制台没有输出,可以尝试将适配器的 tx 引脚连接到开发板的 rx 引脚,适配器的 rx 引脚连接到开发板的 tx 引脚,即交换一下 tx、rx 引脚。
串口参数配置
roc-rk3328-pc 使用如下配置:
波特率:1,500,000
数据位:8
停止位:1
奇偶检查:无
流控:无
接下来,根据操作系统的不同,为你介绍详细的操作说明。
windows 下的串口调试
安装驱动
安装卖家推荐的 usb 串口适配器驱动。如果没有,可以检查芯片组并尝试以下驱动
ch340
pl2303
cp210x
提示:如果 pl2303 在 win8 下无法工作,则可以尝试将驱动程序降级到版本 3.3.5.122 或之前。
安装驱动后,将适配器连接到主机的 usb 端口。操作系统将提示检测到新硬件。完成后,可以在设备管理器中找到新的com端口:
安装工具
windows 中有很多串口终端工具,例如 putty 和 securecrt。以下介绍putty这款流行的开源软件的使用。
putty 下载地址
下载 putty.zip,解压并运行 putty.exe:
选择 “connection type” 为 “serial”。
将 “serial line” 修改为在设备管理器中找到的 com 端口。
设置 “speed” 为 1500000 。
点击 “open” 按钮。
linux 下的串口调试
如果 usb 串口适配器的芯片组受 linux 内核支持,驱动程序将自动加载。
连接串口适配器,并通过如下命令检查相应的串口设备文件:
$ ls -l /dev/ttyusb* crw-rw---- 1 root uucp 188, 0 apr 10 16:44 /dev/ttyusb0
将你的 linux 用户添加到 uucp 组中,以便获得访问此设备的权限(否则每次需要在命令前加sudo来运行相应命令):
sudo gpasswd -a $(whoami) uucp
用户组的更改将在注销并重新登录 linux 后生效,或使用 newgrp 命令进入带有新组的 shell:
newgrp uucp
然后根据偏好,使用自己喜欢的串口控制台工具。以下介绍 picocom 和 minicom 。
picocom
picocom 轻便小巧, 容易使用。
安装 picocom 命令:
sudo apt-get install picocom
启动 picocom:
$ picocom -b 1500000 /dev/ttyusb0 picocom v3.1 port is : /dev/ttyusb0 flowcontrol : none baudrate is : 1500000 parity is : none databits are : 8 stopbits are : 1 escape is : c-a local echo is : no noinit is : no noreset is : no hangup is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv -e imap is : omap is : emap is : crcrlf,delbs, logfile is : none initstring : none exit_after is : not set exit is : no type [c-q] [c-h] to see available commands terminal ready
上面的信息显示 ctrl-a 是转义键。 按下 ctrl-a ctrl-q 将退出 picocom 并返回到 shell 。
minicom
安装 minicom 命令:
sudo apt-get install minicom
启动 minicom:
$ minicom welcome to minicom 2.7 options: i18n compiled on jan 1 2014, 17:13:19. port /dev/ttyusb0, 15:57:00 press ctrl-a z for help on special keys
根据以上提示: 按 ctrl-a,然后按 z(而不是 ctrl-z )调出帮助菜单:
+-------------------------------------------------------------------+ | minicom command summary | | | | commands can be called by ctrl-a | | | | main functions other functions | | | | dialing directory..d run script (go)....g | clear screen.......c | | send files.........s receive files......r | configure minicom..o | | comm parameters....p add linefeed.......a | suspend minicom....j | | capture on/off.....l hangup.............h | exit and reset.....x | | send break.........f initialize modem...m | quit with no reset.q | | terminal settings..t run kermit.........k | cursor key mode....i | | linewrap on/off....w local echo on/off..e | help screen........z | | paste file.........y timestamp toggle...n | scroll back........b | | add carriage ret...u | | | | select function or press enter for none. | +-------------------------------------------------------------------+
按提示按 o 进入设置屏幕:
+-----[configuration]------+ | filenames and paths | | file transfer protocols | | serial port setup | | modem and dialing | | screen and keyboard | | save setup as dfl | | save setup as.. | | exit | +--------------------------+
选择 serial port setup,然后按选项前面的大写字母并设置为如下所示的值:
+-----------------------------------------------------------------------+ | a - serial device : /dev/ttyusb0 | | b - lockfile location : /var/lock | | c - callin program : | | d - callout program : | | e - bps/par/bits : 1500000 8n1 | | f - hardware flow control : no | | g - software flow control : no | | | | change which setting? | +-----------------------------------------------------------------------+
注意:
hardware flow control 和 software flow control 应该设置为 no 。
结束设置之后, 按 esc 键回到之前的菜单, 选择 save setup as dfl 保存覆盖掉默认配置。
5G时代下未来网盘发展将呈现出更丰富和更繁荣的万物互联两大趋势
朱立锋:关于加快推动工业互联网融合创新发展的建议
昌盛电气密封铅酸蓄电池荣获最佳新产品奖
供应/回收 HP8591E,HP8594E,R3361C,M
物联网终端你了解的彻底吗
fireflyROC-RK3328主板PC串口调试简介
三星全新A系列机型GalaxyA60曝光 将采用A8s上的Infinity-O开孔全面屏技术
“人形机器人第一股”优必选今日港交所上市
华为携手伙伴联合打造昇腾智城解决方案 加速城市的智能化建设
2011年中国晶圆代工行业企业竞争分析
现代电子产品可靠性的概述
工业数据采集的范围、特点及结构
直流电机运转不正常的原因有哪些
python解析库的使用--PyQuery
双硬盘是什么 相比单硬盘有什么优势
晶电欲将台湾地区现有产能转至大陆地区生产 将对传统LED毛利率的提升有助益
投资人工智能能躺赢吗
TI TPS65987DUSB Type-C和PD控制器解决方案
分励脱扣器是什么_分励脱扣器工作原理解析
石油数字孪生可视化管理平台,推动石油行业数字化转型与智能化应用