买了一套友善的板子 micro2440
由于win下面的DNW不是很好用
于是便装了FC14下面的dnw for linux ,很好用,也很方便
1 下载 DNW for linux
友善的BBS上面可下载
我也共享了一个免费下载: http://download.csdn.net/source/3076530 ,
2 安装
2.1 解压
$tar xzvf dnw_linux.tar.gz
dnw_linux/
dnw_linux/secbulk/
dnw_linux/secbulk/Makefile
dnw_linux/secbulk/secbulk.c
dnw_linux/dnw/
dnw_linux/dnw/dnw.c
其中secbulk.c是linux的USB驱动, dnw.c 是写入工具的源代码
2.2 驱动模块的编译与加载
$cd secbulk
$make -C /lib/modules/`uname -r`/build M=`pwd` modules
如果编译出错,差东西,可能是没有装内核的东西
用 yum 等下载安装kernel-devel kernel-headers
编译成功后在当前目录下可以看到secbulk.ko
[ty@tiany dnw]$ ll
total 352
-rw-rw-r-- 1 ty ty 42 Oct 25 2008 Makefile
-rw-r--r-- 1 root root 55 Mar 9 15:46 modules.order
-rw-r--r-- 1 root root 0 Mar 9 15:46 Module.symvers
-rw-rw-r-- 1 ty ty 4530 Jan 6 2009 secbulk.c
-rw-r--r-- 1 root root 164268 Mar 9 15:46 secbulk.ko
-rw-r--r-- 1 root root 497 Mar 9 15:46 secbulk.mod.c
-rw-rw-r-- 1 root root 45328 Mar 9 15:46 secbulk.mod.o
-rw-r--r-- 1 root root 120112 Mar 9 15:46 secbulk.o
insmod 加载模块,注意 root 权限
$sudo insmod secbulk.ko
成功加载后用 dmesg 命令查看日志, 通过grep过滤
[ty@tiany dnw]$ dmesg | grep secbulk
[ 1882.227272] secbulk:secbulk loaded
[ 1882.227305] usbcore: registered new interface driver secbulk
2.3 编译 dnw 工具
$cd dnw
$gcc -o dnw dnw.c
编译成功后生成可执行dnw
3 使用
我是fc14系统,内核版本为
[ty@tiany dnw]$ uname -a
Linux tiany.lab2202 2.6.35.6-45.fc14.i686 #1 SMP Mon Oct 18 23:56:17 UTC 2010 i686 i686 i386 GNU/Linux
连上设备,用dmesg可以看到usb链接的信息
[ 1152.956029] usb 7-2: new full speed USB device using uhci_hcd and address 4
[ 1153.115268] usb 7-2: New USB device found, idVendor=5345, idProduct=1234
[ 1153.115271] usb 7-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1153.115274] usb 7-2: Product: SEC S3C2410X Test B/D
[ 1153.115275] usb 7-2: Manufacturer: System MCU
[ 1824.500201] usb 7-2: USB disconnect, address 4
[ 1882.227272] secbulk:secbulk loaded
[ 1882.227305] usbcore: registered new interface driver secbulk
[ 2061.736044] usb 7-2: new full speed USB device using uhci_hcd and address 5
[ 2061.897086] usb 7-2: New USB device found, idVendor=5345, idProduct=1234
[ 2061.897092] usb 7-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2061.897097] usb 7-2: Product: SEC S3C2410X Test B/D
[ 2061.897100] usb 7-2: Manufacturer: System MCU
[ 2061.900170] secbulk:secbulk probing...
[ 2061.900174] secbulk:bulk out endpoint found!
正确链接后就可以利用DNW工具下载
[ty@tiany dnw]$ sudo ./dnw 2440test_N35.bin
[sudo] password for ty:
file name : 2440test_N35.bin
file size : 4033684 bytes
Writing data...
100% 4033694 bytes OK
OK,安装测试完毕,使用很方便
笔记
发现一个奇怪的问题,我用的Mirco2440SDK这块板子,
更换核心板后,dnw老是用不起,不知道为什么
secbulk.ko
可以加载成功,但是连接上USB后 dmesg查看消息 输出以下错误
611.547551] usbcore: registered new interface driver secbulk
[ 637.539046] usb 7-1: new full speed USB device using uhci_hcd and address 10
[ 637.653055] usb 7-1: device descriptor read/64, error -71
[ 637.868175] usb 7-1: device descriptor read/64, error -71
[ 638.071186] usb 7-1: new full speed USB device using uhci_hcd and address 11
[ 638.185052] usb 7-1: device descriptor read/64, error -71
[ 638.399067] usb 7-1: device descriptor read/64, error -71
[ 638.602053] usb 7-1: new full speed USB device using uhci_hcd and address 12
[ 639.011046] usb 7-1: device not accepting address 12, error -71
[ 639.164052] usb 7-1: new full speed USB device using uhci_hcd and address 13
[ 639.573154] usb 7-1: device not accepting address 13, error -71
[ 639.573180] hub 7-0:1.0: unable to enumerate USB device on port 1
不知道为什么
然后我换回之前调试的核心板
又可以使用了
[ 756.766161] usb 7-1: new full speed USB device using uhci_hcd and address 14
[ 756.926082] usb 7-1: New USB device found, idVendor=5345, idProduct=1234
[ 756.926089] usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 756.926093] usb 7-1: Product: SEC S3C2410X Test B/D
[ 756.926097] usb 7-1: Manufacturer: System MCU
[ 756.929177] secbulk:secbulk probing...
[ 756.929181] secbulk:bulk out endpoint found!
[ 848.500086] usb 7-1: USB disconnect, address 14
[ 848.500157] secbulk:secbulk disconnected!
[ 849.456052] usb 7-1: new full speed USB device using uhci_hcd and address 15
[ 849.615259] usb 7-1: New USB device found, idVendor=5345, idProduct=1234
[ 849.615265] usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 849.615270] usb 7-1: Product: SEC S3C2410X Test B/D
[ 849.615273] usb 7-1: Manufacturer: System MCU
[ 849.618335] secbulk:secbulk probing...
[ 849.618339] secbulk:bulk out endpoint found!
真实奇怪