iMX6 USB OTG功能开发与测试
2015-06-04 17:03
387 查看
USB接口上有4个管脚,OTG功能有5个。原来4个分别是电 D+ D- 地。 现在增加了一个ID。这个ID线就决定了自己做主设备还是从设备。如果ID线是高则自己是从设备,反之是主设备。
USB_OTG_ID定义为W23,即GPIO1_IO24
/test/gpio_get.sh24用来读出gpio value。读出来总是0:低电平。所以也不知道前面这句描述是对是错了。
imx6 kernel configas:
-> USB GadgetDrivers (<choice> [=m])
->File-backedStorage Gadget(USB_FILE_STORAGE [=m]) 。记得:不是选massstorage. 而且选模块方式,以方便安装模块时输入参数。
内置驱动时,测试打印:
g_file_storagegadget: controller 'fsl-usb2-udc' not recognized
g_file_storagegadget: No serial-number string provided!
g_file_storagegadget: no file given for LUN0
显然,这就是模块参数未给定导致的。
编译模块:
makeM=drivers/usb/gadget/ modules
得到
root@ubuntu:/home/imx6s/linux-3.0.101#make M=drivers/usb/gadget/ modules
Building modules, stage 2.
MODPOST 1 modules
LD [M] drivers/usb/gadget/g_file_storage.ko
root@imx6s ~$insmod /lib/modules/g_file_storage.ko file=/dev/mmcblk0
g_file_storagegadget: controller 'fsl-usb2-udc' not recognized
g_file_storagegadget: No serial-number string provided!
g_file_storagegadget: File-backed Storage Gadget, version: 1 September 2010
g_file_storagegadget: Number of LUNs=1
g_file_storagegadget-lun0: ro=0, nofua=0, file: /dev/mmcblk0
Suspend udc forOTG auto detect
fsl-usb2-udc: bindto driver g_file_storage
root@imx6s ~$g_file_storage gadget: high speed config #1
win7也同时显示说找到设备驱动,磁盘驱动器:linux File-Stor Gadget USB Device
下面反复插拔USB-PC线几次,然后换成USB-SD卡,都是可以的。但再换回USB-PC线就不行了,找不见设备。
root@imx6s ~$g_file_storage gadget: high speed config #1
root@imx6s ~$g_file_storage gadget: high speed config #1
root@imx6s ~$
root@imx6s ~$g_file_storage gadget: high speed config #1
root@imx6s ~$
root@imx6s ~$ usb1-1: new high speed USB device number 2 using fsl-ehci
usb 1-1: devicev0930 p6545 is not supported
scsi0 :usb-storage 1-1:1.0
scsi 0:0:0:0:Direct-Access TOSHIBA TransMemory PMAP PQ: 0 ANSI: 4
sd 0:0:0:0: [sda]30489408 512-byte logical blocks: (15.6 GB/14.5 GiB)
sd 0:0:0:0: [sda]Write Protect is off
sd 0:0:0:0: [sda]No Caching mode page found
sd 0:0:0:0: [sda]Assuming drive cache: write through
sd 0:0:0:0: [sda]No Caching mode page found
sd 0:0:0:0: [sda]Assuming drive cache: write through
sda: sda1
sd 0:0:0:0: [sda]No Caching mode page found
sd 0:0:0:0: [sda]Assuming drive cache: write through
sd 0:0:0:0: [sda]Attached SCSI removable disk
root@imx6s ~$ usb1-1: USB disconnect, device number 2
wait otg vbuschange timeout!
root@imx6s ~$ usb1-1: new high speed USB device number 3 using fsl-ehci
usb 1-1: devicev0930 p6545 is not supported
scsi1 :usb-storage 1-1:1.0
scsi 1:0:0:0:Direct-Access TOSHIBA TransMemory PMAP PQ: 0 ANSI:4
sd 1:0:0:0: [sda]30489408 512-byte logical blocks: (15.6 GB/14.5 GiB)
sd 1:0:0:0: [sda]Write Protect is off
sd 1:0:0:0: [sda]No Caching mode page found
sd 1:0:0:0: [sda]Assuming drive cache: write through
sd 1:0:0:0: [sda]No Caching mode page found
sd 1:0:0:0: [sda]Assuming drive cache: write through
sda: sda1
sd 1:0:0:0: [sda]No Caching mode page found
sd 1:0:0:0: [sda]Assuming drive cache: write through
sd 1:0:0:0: [sda]Attached SCSI removable disk
root@imx6s ~$
root@imx6s ~$ usb1-1: USB disconnect, device number 3
wait otgvbus change timeout!
root@imx6s ~$
root@imx6s ~$ usb1-1: new high speed USB device number 4 using fsl-ehci
usb 1-1: devicev0930 p6545 is not supported
scsi2 :usb-storage 1-1:1.0
scsi 2:0:0:0:Direct-Access TOSHIBA TransMemory PMAP PQ: 0 ANSI: 4
sd 2:0:0:0: [sda]30489408 512-byte logical blocks: (15.6 GB/14.5 GiB)
sd 2:0:0:0: [sda]Write Protect is off
sd 2:0:0:0: [sda]No Caching mode page found
sd 2:0:0:0: [sda]Assuming drive cache: write through
sd 2:0:0:0: [sda]No Caching mode page found
sd 2:0:0:0: [sda]Assuming drive cache: write through
sda: sda1
sd 2:0:0:0: [sda]No Caching mode page found
sd 2:0:0:0: [sda]Assuming drive cache: write through
sd 2:0:0:0: [sda]Attached SCSI removable disk
usb 1-1: USBdisconnect, device number 4
wait otg vbuschange timeout!
USB在host模式时,才需要对外输出电源。slave mode时,不需要输出电源,但也不影响工作。
电源管脚:
IMX_GPIO_NR(4, 15),111
/test/gpio_set.sh111 0 //关pwr
实测不影响工作。其实,我觉得USB_ID和USB_VBUS就没什么关系。
USB_OTG_ID定义为W23,即GPIO1_IO24
/test/gpio_get.sh24用来读出gpio value。读出来总是0:低电平。所以也不知道前面这句描述是对是错了。
imx6 kernel configas:
-> USB GadgetDrivers (<choice> [=m])
->File-backedStorage Gadget(USB_FILE_STORAGE [=m]) 。记得:不是选massstorage. 而且选模块方式,以方便安装模块时输入参数。
内置驱动时,测试打印:
g_file_storagegadget: controller 'fsl-usb2-udc' not recognized
g_file_storagegadget: No serial-number string provided!
g_file_storagegadget: no file given for LUN0
显然,这就是模块参数未给定导致的。
编译模块:
makeM=drivers/usb/gadget/ modules
得到
root@ubuntu:/home/imx6s/linux-3.0.101#make M=drivers/usb/gadget/ modules
Building modules, stage 2.
MODPOST 1 modules
LD [M] drivers/usb/gadget/g_file_storage.ko
root@imx6s ~$insmod /lib/modules/g_file_storage.ko file=/dev/mmcblk0
g_file_storagegadget: controller 'fsl-usb2-udc' not recognized
g_file_storagegadget: No serial-number string provided!
g_file_storagegadget: File-backed Storage Gadget, version: 1 September 2010
g_file_storagegadget: Number of LUNs=1
g_file_storagegadget-lun0: ro=0, nofua=0, file: /dev/mmcblk0
Suspend udc forOTG auto detect
fsl-usb2-udc: bindto driver g_file_storage
root@imx6s ~$g_file_storage gadget: high speed config #1
win7也同时显示说找到设备驱动,磁盘驱动器:linux File-Stor Gadget USB Device
下面反复插拔USB-PC线几次,然后换成USB-SD卡,都是可以的。但再换回USB-PC线就不行了,找不见设备。
root@imx6s ~$g_file_storage gadget: high speed config #1
root@imx6s ~$g_file_storage gadget: high speed config #1
root@imx6s ~$
root@imx6s ~$g_file_storage gadget: high speed config #1
root@imx6s ~$
root@imx6s ~$ usb1-1: new high speed USB device number 2 using fsl-ehci
usb 1-1: devicev0930 p6545 is not supported
scsi0 :usb-storage 1-1:1.0
scsi 0:0:0:0:Direct-Access TOSHIBA TransMemory PMAP PQ: 0 ANSI: 4
sd 0:0:0:0: [sda]30489408 512-byte logical blocks: (15.6 GB/14.5 GiB)
sd 0:0:0:0: [sda]Write Protect is off
sd 0:0:0:0: [sda]No Caching mode page found
sd 0:0:0:0: [sda]Assuming drive cache: write through
sd 0:0:0:0: [sda]No Caching mode page found
sd 0:0:0:0: [sda]Assuming drive cache: write through
sda: sda1
sd 0:0:0:0: [sda]No Caching mode page found
sd 0:0:0:0: [sda]Assuming drive cache: write through
sd 0:0:0:0: [sda]Attached SCSI removable disk
root@imx6s ~$ usb1-1: USB disconnect, device number 2
wait otg vbuschange timeout!
root@imx6s ~$ usb1-1: new high speed USB device number 3 using fsl-ehci
usb 1-1: devicev0930 p6545 is not supported
scsi1 :usb-storage 1-1:1.0
scsi 1:0:0:0:Direct-Access TOSHIBA TransMemory PMAP PQ: 0 ANSI:4
sd 1:0:0:0: [sda]30489408 512-byte logical blocks: (15.6 GB/14.5 GiB)
sd 1:0:0:0: [sda]Write Protect is off
sd 1:0:0:0: [sda]No Caching mode page found
sd 1:0:0:0: [sda]Assuming drive cache: write through
sd 1:0:0:0: [sda]No Caching mode page found
sd 1:0:0:0: [sda]Assuming drive cache: write through
sda: sda1
sd 1:0:0:0: [sda]No Caching mode page found
sd 1:0:0:0: [sda]Assuming drive cache: write through
sd 1:0:0:0: [sda]Attached SCSI removable disk
root@imx6s ~$
root@imx6s ~$ usb1-1: USB disconnect, device number 3
wait otgvbus change timeout!
root@imx6s ~$
root@imx6s ~$ usb1-1: new high speed USB device number 4 using fsl-ehci
usb 1-1: devicev0930 p6545 is not supported
scsi2 :usb-storage 1-1:1.0
scsi 2:0:0:0:Direct-Access TOSHIBA TransMemory PMAP PQ: 0 ANSI: 4
sd 2:0:0:0: [sda]30489408 512-byte logical blocks: (15.6 GB/14.5 GiB)
sd 2:0:0:0: [sda]Write Protect is off
sd 2:0:0:0: [sda]No Caching mode page found
sd 2:0:0:0: [sda]Assuming drive cache: write through
sd 2:0:0:0: [sda]No Caching mode page found
sd 2:0:0:0: [sda]Assuming drive cache: write through
sda: sda1
sd 2:0:0:0: [sda]No Caching mode page found
sd 2:0:0:0: [sda]Assuming drive cache: write through
sd 2:0:0:0: [sda]Attached SCSI removable disk
usb 1-1: USBdisconnect, device number 4
wait otg vbuschange timeout!
USB在host模式时,才需要对外输出电源。slave mode时,不需要输出电源,但也不影响工作。
电源管脚:
IMX_GPIO_NR(4, 15),111
/test/gpio_set.sh111 0 //关pwr
实测不影响工作。其实,我觉得USB_ID和USB_VBUS就没什么关系。
相关文章推荐
- Android系统及当前应用配置操作信息相关的常用API
- miniUI Tabs 懒加载
- MFC 改变控件大小和位置
- AngularJS学习之路--- $on、$emit和$broadcast的使用
- 如何在创建表时同时创建外键
- [BZOJ3240][Noi2013]矩阵游戏 && 快速幂
- 宏countof() 得到数组长度
- linux c 编程 log输出
- 实现简答LinkedList
- windows环境,用python实现SSH操作
- blocks 循环引用问题
- zigbee,质量追溯系统,上位机,mis系统,强大版,C#(一)
- 图像分割—基于图的图像分割(Graph-BasedImageSegmentation)
- 14.2 添加群集功能
- 算法导论16(贪心算法)
- iOS开发零基础教程之程序开发调试技巧
- Android 使用Gif图片及其注意点
- html基本进阶知识
- ubuntu源码安装R语言
- 【一起驴友】公司笔试