【linux】openwrt安装和使用minicom进行串口通信
本文讲述如何在【linux】openwrt环境下安装和使用minicom进行串口通信。
查询软件源里面有没有minicom包
opkg list先看一下软件源里面有没有minicom包
安装 minicom
有的话就直接安装 opkg install minicom,安装完后执行minicom -v查看版本信息确认是否安装成功
没有话联网更新opkg, 操作如下:
- root@SunLink:~# opkg update
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/base/Packages.gz.[/url]
- Updated list of available packages in /var/opkg-lists/chaos_calmer_base.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/base/Packages.sig.[/url]
- Signature check passed.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/luci/Packages.gz.[/url]
- Updated list of available packages in /var/opkg-lists/chaos_calmer_luci.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/luci/Packages.sig.[/url]
- Signature check passed.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/management/Packages.gz.[/url]
- Updated list of available packages in /var/opkg-lists/chaos_calmer_management.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/management/Packages.sig.[/url]
- Signature check passed.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/packages/Packages.gz.[/url]
- Updated list of available packages in /var/opkg-lists/chaos_calmer_packages.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/packages/Packages.sig.[/url]
- Signature check passed.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/routing/Packages.gz.[/url]
- Updated list of available packages in /var/opkg-lists/chaos_calmer_routing.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/routing/Packages.sig.[/url]
- Signature check passed.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/telephony/Packages.gz.[/url]
- Updated list of available packages in /var/opkg-lists/chaos_calmer_telephony.
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/telephony/Packages.sig.[/url]
- Signature check passed.
- root@SunLink:~# opkg install minicom
- Installing minicom (2.7-1) to root...
- Downloading [url]http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7628/packages/packages/minicom_2.7-1_ramips_24kec.ipk.[/url]
- Configuring minicom.
复制代码
查看开发板串口设备
- root@SunLink:~# ls /dev/tty*
- /dev/tty /dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3
复制代码 注:
/dev/ttyS0 /dev/ttyS1 /dev/ttyS2 MT7628开发自带的串口
UART2与网口1复用说明
UART2与网口1不能同时使用,只能2选1
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3 是EC20 4G模块枚举的串口,下期讲用4G模块拔打电话时,会用到。
用minicom进行串口通信
我们这次用到的串口是 ttyS1,执行minicom -s ttyS1 进行配置,选择serial port setup菜单
配置相应的波特率,关闭流控
然后保存配置,save setup as ttyS1,保存完后选择Exit,进入到minicom主界面
PC端打串口调试助手,就可以测试串口通信了
|