固件类型:官方提供的固件
固件文件名称:ROC-RK3566-PC_Ubuntu20.04-r21156_v1.2.4a_220519
固件下载地址:https://drive.google.com/drive/folders/1nLuCtabCVMGLwTwx5dFcu9mV805CagaG
Log日志:firefly_linux_defconfig.txt
项目有需要USB转RS485的需求。
插上去后lsusb显示为
root@firefly:~# lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 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 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
期望可以使用ttyUSB0
自己试图解决的方法
1、在这个系统上编译CH340驱动
①安装Linux头文件
②发现CH340官方驱动有问题报错,替换成了GitHub - juliagoda/CH341SER: CH341SER driver with fixed bug · GitHub
③仍然有报错
scripts/basic/fixdep: Exec format error 难以解决,于是换方法
2、重新编固件
①参考官方文档,打开内核所有USBCAN选项
②保存配置文件到firefly_linux_defconfig
③加载Ubuntu的mk文件 ./build.sh roc-rk3566-pc-ubuntu.mk
④./build.sh
搞出来的固件仍然不能解决问题
增加了CONFIG_USB_SERIAL_CH341=y 也不行,甚至打包出来的固件文件和不加这一行的一样大(可能我还没有理解firefly的工程)
希望大佬帮忙,help
tchip_askquestions
firefly_linux_defconfig.txt (15.6 KB)
Liuth
August 8, 2022, 2:27am
2
方法一应该是正确的方法,“CH340官方驱动有问题”,这个我感觉不太可能,你确定是官方的程序有bug?还是你编译过程操作不当?
Liuth
August 9, 2022, 7:48am
3
只能自己编译驱动,如果编译出问题就根据报错信息解决
目前我的内核为4.19.232
但是官方文档里提供的驱动支持到3
Current Driver support versions of linux kernel range from 2.6.25 to 3.13.x
gcc版本为 gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
编译日志如下
root@firefly:/home/firefly/CH341SER_LINUX# make
make -C /lib/modules/4.19.232/build M=/home/firefly/CH341SER_LINUX
make[1]: Entering directory ‘/usr/src/linux-headers-4.19.232’
CC [M] /home/firefly/CH341SER_LINUX/ch34x.o
/home/firefly/CH341SER_LINUX/ch34x.c: In function ‘ch34x_close’:
/home/firefly/CH341SER_LINUX/ch34x.c:591:2: error: unknown type name ‘wait_queue_t’; did you mean ‘wait_event’?
591 | wait_queue_t wait;
| ^~~~~~~~~~~~
| wait_event
/home/firefly/CH341SER_LINUX/ch34x.c:591:15: warning: unused variable ‘wait’ [-Wunused-variable]
error, forbidden warning:ch34x.c:591
591 | wait_queue_t wait;
| ^~~~
/home/firefly/CH341SER_LINUX/ch34x.c:590:7: warning: unused variable ‘timeout’ [-Wunused-variable]
error, forbidden warning:ch34x.c:590
590 | long timeout;
| ^~~~~~~
/home/firefly/CH341SER_LINUX/ch34x.c:589:6: warning: unused variable ‘bps’ [-Wunused-variable]
error, forbidden warning:ch34x.c:589
589 | int bps;
| ^~~
/home/firefly/CH341SER_LINUX/ch34x.c: In function ‘wait_modem_info’:
/home/firefly/CH341SER_LINUX/ch34x.c:797:7: error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]
797 | if( signal_pending(current) )
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:340: /home/firefly/CH341SER_LINUX/ch34x.o] Error 1
make[1]: *** [Makefile:1676: module /home/firefly/CH341SER_LINUX] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.19.232’
make: *** [Makefile:5: default] Error 2
请问能不能在Ubuntu20.04上使用CH340芯片进行USB到rs480转换唔
商家给的驱动也是这个驱动,来源是https://www.wch.cn/download/CH341SER_LINUX_ZIP.html
这个驱动可以是在linux中内置的,见https://elixir.bootlin.com/linux/v4.19.232/source/drivers/usb/serial/ch341.c
但是使用从linux源码来的这个文件编译后依然报错
root@firefly:/home/firefly/CH341SER_LINUX# make
make -C /lib/modules/4.19.232/build M=/home/firefly/CH341SER_LINUX
make[1]: Entering directory ‘/usr/src/linux-headers-4.19.232’
CC [M] /home/firefly/CH341SER_LINUX/ch341.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:340: /home/firefly/CH341SER_LINUX/ch341.o] Error 2
make[2]: *** Deleting file ‘/home/firefly/CH341SER_LINUX/ch341.o’
make[1]: *** [Makefile:1676: module /home/firefly/CH341SER_LINUX] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.19.232’
make: *** [Makefile:5: default] Error 2
还是请firefly官方可以提供包含CH340驱动的ubuntu镜像
Liuth
August 15, 2022, 2:27am
7
bailongjuan 发表于 2022-8-12 23:04
商家给的驱动也是这个驱动,来源是https://www.wch.cn/download/CH341SER_LINUX_ZIP.html
这个驱动可以是 …
我编译好了啊,就是用的你给的商家驱动
都说了会报错就根据信息处理一下,说 unused variable ,那把没用的变量删除就行
然后 error: implicit declaration of function ‘signal_pending’百度一下就有了
https://blog.csdn.net/gehong3641/article/details/123149941
我根据你说的修改了后仍然报错无法解决,修改的文件见附件
root@firefly:/home/firefly/CH341SER_LINUX# make
make -C /lib/modules/4.19.232/build M=/home/firefly/CH341SER_LINUX
make[1]: Entering directory ‘/usr/src/linux-headers-4.19.232’
CC [M] /home/firefly/CH341SER_LINUX/ch34x.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:340: /home/firefly/CH341SER_LINUX/ch34x.o] Error 2
make[2]: *** Deleting file ‘/home/firefly/CH341SER_LINUX/ch34x.o’
make[1]: *** [Makefile:1676: module /home/firefly/CH341SER_LINUX] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.19.232’
make: *** [Makefile:5: default] Error 2
仍然求帮助
CH341SER_LINUX修正后.zip (8.52 KB)
Liuth
August 24, 2022, 1:57am
9
bailongjuan 发表于 2022-8-23 22:03
我根据你说的修改了后仍然报错无法解决,修改的文件见附件
root@firefly:/home/firefly/CH341SER_LINUX# …
你这次看起来像没有正确装好linux-headers
你上次都能编译,这次还没开始就报错