ubuntu cp210x(USB转串口)驱动安装教程

前言

CP2108 是一款高度集成的USB转4路UART的桥接器。
CP2108USB桥接器提供4个独立UART接口,采用集成式USB收发器,无需外部电阻要求;采用集成式时钟,无需外部晶振体要求;采用集成式可编程EEPROM,可用于定制产品信息。内置电源复位电路,符合USB规格2.0标准,通过SUSPEND引脚支持USB挂起状态。自供电电压为3.0至3.6V,USB总线供电电压为4.0至5.5V,可适应温度范围为-40℃至85℃。

1. 驱动下载

下载Linux版本需要先注册silicon官方账号
下载地址 silicon官网 cp210x 驱动代码下载地址

2. 驱动编译和安装

  • 查看内核版本
uname -r
  • 编译
cd (cp210x driver folder)
make ( your cp210x driver )
  • 安装
cp cp210x.ko to /lib/modules/<kernel-version>/kernel/drivers/usb/serial
insmod /lib/modules/<kernel-version/kernel/drivers/usb/serial/usbserial.ko
insmod cp210x.ko
  • 安装后需要重新启动

3. 可能遇到的问题及解决办法

进行 make 时出现以下错误:

.port_remove  = cp210x_port_remove,
...
...
make: *** [all] Error

3.1 第一种解决方案:检查当前是否已有CP210x.ko驱动

/lib/modules/<kernel-version>/kernel/drivers/usb/serial

查看当前地址下是否已经存在CP210x.ko,如果存在直接加载即可

modprobe usbserial
modprobe cp210x

或者卸载重新安装

rmmod cp210x

安装后重启。

3.2 第二种解决方案:修改驱动文件,编译

另外一种解决方案,是函数cp210x_port_remove兼容问题,打开cp210x.c文件,找到函数cp210x_port_remove

  • 将函数定义的返回值由int修改为void
  • 函数实现的地方也要由int修改为void,并且注掉函数中return 0
    重新编译安装重启即可
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
This bundle contains a modified CP210x driver for the 4.10.0 kernel (Ubuntu 17.04). It contains: - Support for the CP2102N NOTE: This driver is an example of how to perform GPIO operations within the CP210x driver since the driver on kernel.org does not support GPIO at this time. This driver has only been written and tested on the Linux 3.13.0 kernel on Ubuntu 14.04. This driver is a modified version of the existing driver in the Linux 3.13.0 kernel, which is maintained at kernel.org. It is recommened to use the driver there that matches your specific kernel version: www.kernel.org Build instrutions: Ubuntu: 1. make ( your cp210x driver ) 2. cp cp210x.ko to /lib/modules//kernel/drivers/usb/serial 3. insmod /lib/modules/<kernel-version/kernel/drivers/usb/serial/usbserial.ko 4. insmod cp210x.ko RedHat: 1. yum update kernel* //need to update the kernel first otherwise your header won't match 2. yum install kernel-devel kernel-headers //get the devel and header packages. 3. reboot //your build link should be fixed after your system come back 4. make ( your cp210x driver ) // should be able to build successfully at this point 5. cp cp210x.ko to /lib/modules//kernel/drivers/usb/serial 6a. insmod /lib/modules/<kernel-version/kernel/drivers/usb/serial/usbserial.ko 6. insmod cp210x.ko 7. sudo chmod 666 /dev/ttyUSB0 8. sudo chmod 666 /dev/ttyUSB1 GPIO example: This shows how to use the two IOCTLs to set GPIO state. Build instructions: 1. g++ cp210x_gpio_example.c -o cp210x_gpio_example 2. ./cp210x_gpio_example

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值