串口是嵌入式开发使用最多的通信方式,linux系统提供了一个串口工具minicom,可以完成复杂的串口通信工作。
Ubuntu下也有这样的串口通信工具,比如Minicom,kermit。minicom比较通用,kermit比较好用。
1.minicom。
安装suodo apt-get install minicom
Minicom的使用
1. 启动minicom
以root权限登录系统
使用命令
root –s 则minicom启动,屏幕出现如下的界面|:
……………[configuration]……………………………………
…… Filename and paths ………………………
…… File transfer and protocols ………………
…… Serial port setup …………………
…… Modem and dialing …………………………
…… Screen and keyboard …………
…… Save setup as df1 …………………
…… Save setup as…… …………………………
…… Exit …………………………
…… Exit from minicom …………………………
………………………………
2. 设置serial port setup
使用down箭头选择serial port setup,出现具体各选项的配置:
A — Serial Device : /dev/ttyS0
B — lockfile Location : /var/lock
C — Calling Program :
D — Callout Program:
E — Bps/par/Bits : 9600 8N1
F — Hardware Flow Control : YES
G — Software Flow Control : NO
Change with setting?
将选项A的值设置为/dev/ttyS0 表示是串口1。
将选项E的值设置为9600。
设置过程中命令的使用,例如需要修改选项A的值,在Change with setting?选项后输入A则光标转移到A选项后,可以对A选项的值进行修改。
3.设置Modem and dialing
使用方向箭头选中modem and dialing 项,则修改modem and dialing 选项中的配置项。
需要修改的是去掉
A — initing string ……:
B — Reset string ……:
K — Hang-up string ……三个配置项。
4.选择Save as df1
选择Save as df1选项将修改后的配置信息进行保存为默认的配置选项。
5.Exit from minicom