TI中文支持网
TI专业的中文技术问题搜集分享网站

am335x的USB认不到优盘

自己做的板子,USB口插上鼠标可以使用,但是插上优盘就不能工作。

linux内核配置肯定是没问题的,我的配置按照这个文档检查过,该选的都选上了:http://processors.wiki.ti.com/index.php/UsbConfigHostMSC

另外也用SDK里最原始未改过的.config试过,结果也一样。也可以排除优盘的问题,试过好几个优盘了。

插上优盘,串口就会出现如下打印:

[ 596.043385] usb 1-1: new high-speed USB device number 17 using musb-hdrc
[ 596.103419] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 596.383361] usb 1-1: new high-speed USB device number 18 using musb-hdrc
[ 596.443384] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 596.723357] usb 1-1: new high-speed USB device number 19 using musb-hdrc
[ 596.783376] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 597.063357] usb 1-1: new high-speed USB device number 20 using musb-hdrc
[ 597.123373] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 597.403356] usb 1-1: new high-speed USB device number 21 using musb-hdrc
[ 597.463374] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 597.743357] usb 1-1: new high-speed USB device number 22 using musb-hdrc
[ 597.803374] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 598.083379] usb 1-1: new high-speed USB device number 23 using musb-hdrc
[ 598.143411] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 598.423360] usb 1-1: new high-speed USB device number 24 using musb-hdrc
[ 598.483388] hub 1-0:1.0: unable to enumerate USB device on port 1

我手头上有一块StarterKit,同一个优盘插在StarterKit上就能用,StarterKit串口打印如下:

[ 454.136413] usb 1-1: new high-speed USB device number 3 using musb-hdrc
[ 454.276611] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 256
[ 454.286041] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 256
[ 454.295867] usb 1-1: New USB device found, idVendor=071b, idProduct=3203
[ 454.302856] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 454.310333] usb 1-1: Product: ROCK MP3
[ 454.314208] usb 1-1: Manufacturer: RockChip
[ 454.318603] usb 1-1: SerialNumber: USBV1.00
[ 454.332702] usb-storage 1-1:1.0: Quirks match for vid 071b pid 3203: 400
[ 454.339904] scsi1 : usb-storage 1-1:1.0
[ 455.357299] scsi 1:0:0:0: Direct-Access RockChip USB MP3 1.00 PQ: 0 ANSI: 0
[ 455.372863] sd 1:0:0:0: [sda] 7929856 512-byte logical blocks: (4.06 GB/3.78 GiB)
[ 455.392944] sd 1:0:0:0: [sda] Write Protect is off
[ 455.407775] sd 1:0:0:0: [sda] No Caching mode page present
[ 455.413513] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 455.424133] sd 1:0:0:0: [sda] No Caching mode page present
[ 455.429901] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 455.438049] sda:
[ 455.443847] sd 1:0:0:0: [sda] No Caching mode page present
[ 455.449645] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 455.455993] sd 1:0:0:0: [sda] Attached SCSI removable disk

Hui Yin:

补充一下最新发现:

在代码里加打印逐步查找故障,发现函数hub_port_reset() 返回值 -107 (-ENOTCONN)

继续查找,发现函数usb_control_msg() 返回值 -19  (-ENODEV)

再继续,最终找到了这个函数里面:musb_urb_enqueue(),失败原因是 musb->is_active 为零,见下面红色部分。

至此没法再跟踪下去了,请看一下这是怎么回事。

static int musb_urb_enqueue( struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags){ unsigned long flags; struct musb *musb = hcd_to_musb(hcd); struct usb_host_endpoint *hep = urb->ep; struct musb_qh *qh; struct usb_endpoint_descriptor *epd = &hep->desc; int ret; unsigned type_reg; unsigned interval;

/* host role must be active */ if (!is_host_active(musb) || !musb->is_active) return -ENODEV; spin_lock_irqsave(&musb->lock, flags); ret = usb_hcd_link_urb_to_ep(hcd, urb); qh = ret ? NULL : hep->hcpriv; if (qh) urb->hcpriv = qh;

INIT_LIST_HEAD(&urb->giveback_list); spin_unlock_irqrestore(&musb->lock, flags);

Yaoming Qin:

回复 Hui Yin:

插u盘的时候,有vbus上有供电吗,你的电路设计和EVM板上一样吗

Hui Yin:

回复 Yaoming Qin:

VBUS上是有电的,用示波器测了,插上优盘的前后始终都有5V电压。

下面是USB部分的原理图,你看一下有没有问题。

怎么鼠标可以工作,优盘就不行呢?

Hui Yin:

回复 Hui Yin:

我把ESD保护器件U4以及串联的两个电阻去掉了,直接用铜线飞过去。

现在可以认到有优盘,但是/dev目录下仍然没有优盘的设备文件。

这是现在的串口打印信息。

[ 128.693106] usb 2-1: new high-speed USB device number 4 using musb-hdrc[ 128.888655] usb 2-1: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 256[ 128.898125] usb 2-1: config 1 interface 0 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 256[ 128.960367] usb 2-1: New USB device found, idVendor=071b, idProduct=3203[ 128.967381] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3[ 128.974838] usb 2-1: Product: ROCK MP3[ 128.978746] usb 2-1: Manufacturer: RockChip[ 128.983115] usb 2-1: SerialNumber: USBV1.00[ 129.002549] usb-storage 2-1:1.0: Quirks match for vid 071b pid 3203: 400[ 129.010004] scsi2 : usb-storage 2-1:1.0

再把上面帖子里提到的正常打印放在这里对比一下,现在的打印信息还是少了后面的一些内容。

这是什么原因呢?

[ 454.136413] usb 1-1: new high-speed USB device number 3 using musb-hdrc[ 454.276611] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 256[ 454.286041] usb 1-1: config 1 interface 0 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 256[ 454.295867] usb 1-1: New USB device found, idVendor=071b, idProduct=3203[ 454.302856] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3[ 454.310333] usb 1-1: Product: ROCK MP3[ 454.314208] usb 1-1: Manufacturer: RockChip[ 454.318603] usb 1-1: SerialNumber: USBV1.00[ 454.332702] usb-storage 1-1:1.0: Quirks match for vid 071b pid 3203: 400[ 454.339904] scsi1 : usb-storage 1-1:1.0[ 455.357299] scsi 1:0:0:0: Direct-Access RockChip USB MP3 1.00 PQ: 0 ANSI: 0[ 455.372863] sd 1:0:0:0: [sda] 7929856 512-byte logical blocks: (4.06 GB/3.78 GiB)[ 455.392944] sd 1:0:0:0: [sda] Write Protect is off[ 455.407775] sd 1:0:0:0: [sda] No Caching mode page present[ 455.413513] sd 1:0:0:0: [sda] Assuming drive cache: write through[ 455.424133] sd 1:0:0:0: [sda] No Caching mode page present[ 455.429901] sd 1:0:0:0: [sda] Assuming drive cache: write through[ 455.438049] sda:[ 455.443847] sd 1:0:0:0: [sda] No Caching mode page present[ 455.449645] sd 1:0:0:0: [sda] Assuming drive cache: write through[ 455.455993] sd 1:0:0:0: [sda] Attached SCSI removable disk

Hui Yin:

回复 Hui Yin:

现在USB的差分线上已经没有任何其它东西了,5V电源也正常,硬件方面好像没什么可尝试的了。

能认出设备,但是/dev没有设备文件。从打印来看,USB这块儿是没问题的,问题出在SCSI那里,应该是个软件问题。

刚才又核对了一遍内核配置,文档里要求的那几个选项都选上了。

除了文档里提到的这几个选项之外,是不是还有什么必须选的?

Richie jemi:

LZ您好,请问你们还有AM335X系列的CPU吗?能否卖我们几片,现在我们公司项目急用,官方申请太慢了,来不及

赞(0)
未经允许不得转载:TI中文支持网 » am335x的USB认不到优盘
分享到: 更多 (0)