linux 串口信息记到日志,[linux学习笔记]之一:ubuntu ch340调试备忘

[linux学习笔记]之一:ubuntu ch340调试备忘

已有 2183 次阅读2016-11-8 21:52

|个人分类:linux

最近迷上了Linux,入了一块板。电脑使用win7+ubuntu 双系统,可是调试的时候就麻烦了,ubuntu下写好sd卡镜像,调试的时候还要切换到win7,手上的usb转串口驱动芯片时CH340,于是就想看ubuntu下时候可以安装ch340驱动。

网上搜了一下,还真有,不过时很早的内容了。

因为属于小白,所以就摸着走呗...把ch340 一端插入电脑

输入命令: lsmod | grep usbserial

输出:usbserial              53248  1 ch341

成功发现了设备,识别出时 ch341  是我记错了??

输入:lsusb

输出一下信息:

Bus 002 Device 003: ID 17ef:4810 Lenovo Integrated Webcam [R5U877]

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 002: ID 1a81:1004 Holtek Semiconductor, Inc.

Bus 006 Device 003: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 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 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

发现了ch341的一些相关信息

输入命令(查看USB转串口接入状态):dmesg

输出相关信息,部分信息如下:

[  429.184170] usb 6-1: new full-speed USB device number 3 using uhci_hcd

[  429.345937] usb 6-1: New USB device found, idVendor=1a86, idProduct=7523

[  429.345944] usb 6-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0

[  429.345948] usb 6-1: Product: USB2.0-Ser!

[  429.368123] usbcore: registered new interface driver usbserial

[  429.368396] usbcore: registered new interface driver usbserial_generic

[  429.368875] usbserial: USB Serial support registered for generic

[  429.374125] usbcore: registered new interface driver ch341

[  429.374143] usbserial: USB Serial support registered for ch341-uart

[  429.374165] ch341 6-1:1.0: ch341-uart converter detected

[  429.386851] usb 6-1: ch341-uart converter now attached to ttyUSB0

ID信息与lsusb检测到的一致,ch341-uart converter now attached to ttyUSB0  成功驱动,端口为ttyUSB0

太惊喜了。免的安装驱动了

titter.gif

下一步,安装串口终端软件,搜到了一个minicom,动手试试:

安装:sudo apt-get install minicom

打印一些信息,输入‘y’。

等待安装成功,然后用sudo minicom -s 设置minicom的端口对应到ttyUSB0(对应使用dmesg命令看到的信息)。

出现配置菜单:

dc552d706697ccda7828a384c4978b0a.png

选择“Serial port setup”,出现串口配置菜单:

84a0feb1c2ad21bc373b56fd426711d6.png

输入A,修改serial device 由/Dev/tty0修改为/dev/ttyusb0,波特率等修改为115200 8N1。

硬件连接,上电,成功输出打印信息,呵呵

U-Boot SPL 2016.09-rc1 (Oct 01 2016 - 21:31:35)

init i2c

rand test 0 MB RW, err cnt = 0

DRAM:  512 MiB ~

CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2

sunxi_board_init ok!

Trying to boot from MMC1

mmc_dev=0

common/spl/spl_mmc.c L138: mmc_initialize ok

common/spl/spl_mmc.c L155: find_mmc_device ok

part_init: try 'EFI': ret=-1

err=0

mmc_init: 0, time 268

common/spl/spl_mmc.c L298: mmc_init ok

common/spl/spl_mmc.c L335: goto mmc_load_image_raw_sector

hdr read sector 50, count=1

load_legacy

read 906 sectors to 49ffffc0

Jumping to U-Boot

SPL malloc() used 656 bytes (0 KB)

loaded - jumping to U-Boot...

image entry point: 0x

###in board_init_f

U-Boot 2016.09-rc1 (Oct 01 2016 - 21:31:35 +0800) Allwinner Technology

CPU:   Allwinner A13 (SUN5I)

Model: Lichee A13

I2C:   ready

DRAM:  512 MiB

###out board_init_f

###in board_init_r

MMC:   part_init: try 'EFI': ret=-1

part_init: try 'DOS': ret=0

err=0

mmc_init: 0, time 276

*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)

###set hbp=110, ht=1080, hspw=10

###set vbp=45, vt=527, vspw=10

.........

下一篇分享sd卡ubuntu下创建分区,boot/根文件等镜像烧录

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值