Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

绿色网站无广告
会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux培训 > » 正文

linuxUSB转串口文档

来源: xiangqian0505 分享至:
在linux下,用minicom作为终端连接ARM开发板。由于电脑没有串口,需要用usb转串口

首先接上usb转串口,在终端输入:
lsusb查看信息:
crazyleen@crazyleen-desktop:/dev$ lsusb                                                                        
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub                              
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub                              
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub                              
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub                              
Bus 003 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port      
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub                              
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub                              
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub                              

其中这个Bus 003 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port就是我的usb转串口器

然后查看器驱动: ls /dev/ttyUSB*
crazyleen@crazyleen-desktop:/dev$ ls /dev/ttyUSB*
/dev/ttyUSB0

我的串口设备文件就是/dev/ttyUSB0

接下来设置minicom

提示:安装minicom:sudo apt-get install minicom

输入:sudo minicom

Welcome to minicom 2.4

OPTIONS: I18n
Compiled on Jan 25 2010, 06:49:09.
Port /dev/tty8

Press CTRL-A Z for help on special keys         

按   TCRL+A,然后按下Z

Welco+-------------------------------------------------------------------+
     |                     Minicom Command Summary                       |
OPTIO|                                                                   |
Compi|          Commands can be called by CTRL-A <key>                   |
Port |                                                                   |
     |               Main Functions                  Other Functions     |
Press|                                                                   |
     | 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                       | scroll Back........B |
     |                                                                   |
     |      Select function or press Enter for none.                     |
     |                                                                   |
     |             Written by Miquel van Smoorenburg 1991-1995           |
     |             Some additions by Jukka Lahtinen 1997-2000            |
     |             i18n by Arnaldo Carvalho de Melo 1998 

按下o选择设置串口通讯

Welcome to minicom 2.4                                                   
                                                                         
OPTIONS: I18n                                                            
Compiled on Jan 25 2010, 06:49:09.                                       
Port /dev/tty8                                                           
                                                                         
Press CTRL-A Z for help on special keys                                  
                                                                         
            +-----[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   


Welcome to minicom 2.4                                                   
                                                                         
OPTI+-----------------------------------------------------------------------+
Comp| A -    Serial Device      : /dev/tty8                                 |
Port| B - Lockfile Location     : /var/lock                                 |
    | C -   Callin Program      :                                           |
Pres| D -  Callout Program      :                                           |
    | E -    Bps/Par/Bits       : 115200 8N1                                |
    | F - Hardware Flow Control : Yes                                       |
    | G - Software Flow Control : No                                        |
    |                                                                       |
    |    Change which setting?                                              |
    +-----------------------------------------------------------------------+
            | Screen and keyboard      |                                 
            | Save setup as dfl        |                                 
            | Save setup as..          |                                 
            | Exit                     |                                  
            +--------------------------+      
按下A设置设备:/dev/ttyUSB0,按下F关闭flow control

然后保存成dft,就退出
ok,设置完毕




Linux下如何使用USB转串口线?
计算机的串口不能用,怎么与目标板的串口连接呢?


windows下可以用USB转串口线实现,在google上搜索了一下,linux下更简单,连驱动都免装!
测试环境:redhat linux fedora core 4

总结如下:

1. 检查是否存在设备/dev/ttyUSB0,如果没有就建立一个:
mknod /dev/ttyUSB0 c 188 0

以下推理未测试:
如果有多个USB口,可以类推,建立/dev/ttyUSB[1-n],注意从设备号要累加,
如:mknod /dev/ttyUSB[1-n] c 188 [1-n]

2. 启动minicom, 设置串口设备为 /dev/ttyUSB0, 再设置波特率/数据位/停止位,保存为缺省配置df1

3. 重启minicom, 复位目标板,看是否有打印信息?
如果没有请确认:a)USB/串口线没问题,b)确认你使用的USB口是第一个(一个个的试吧,一般电脑不会标示出来)

------------------------------------------------------
Linux下如何使用USB转串口设备

对没有串口的笔记本持有者来说,做硬件开发经常为没有串口而烦恼,不过现在有了USB转串口设备。但是新的问题又出现了,比
如说对于Minicom下的PC机和目标机通信还是存在着一些配置问题,下面就说一下linux下USB转串口的具体配置和问题:






注意:默认情况下ubuntu已经安装了USB转串口驱动(pl2303)。

1、# lsmod | grep usbserial
如果有usbserial,说明系统支持USB转串口。

2、插上USB转串口,在终端输入命令#dmesg | grep ttyUSB0,如果出现连接成功信息,则说明ubuntu系统已经识别该设备了。

注意:虚拟机环境下的ubuntu默认情况下是不能自动识别的,需要在虚拟机窗口右下角点击"Prolific USB-Serial Controller"
,然后选择"Connect (Disconnect from Host)",这样才能被ubuntu系统识别。

3、在上面minicom的配置中设置Serial Device: /dev/ttyUSB0,重启开发板,这样基本上就可以正常使用minicom来打印串口信
息了。


  • linuxUSB转串口文档.rar (9.4 KB)
  • 下载次数: 0

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史