Project

General

Profile

USB2.0 Host on MityDSP-L138F

Added by Hannes Klas over 10 years ago

Hello everyone,

I'm trying to use the USB2-OTG on the MityDSP-L138F as a USB2 Host to connect a few USB-Mass Storage devices.

I'm using the current MDK (2014-01-13) on the supplied Development Board (industrial-i/o). I changed in arch/arm/mach-davinci/baseboard-industrialio.c the line

mityomapl138_usb_init(MUSB_OTG);


to
mityomapl138_usb_init(MUSB_HOST); 


Additionally, I built an adapter cable from the MiniB-Port to USB-A, so that i can connect devices.

When I connect my USB-MSD (a SD Card Reader), it gets enumerated, but doesn't work:

usb 1-1: new high-speed USB device number 2 using musb-hdrc
usb 1-1: default language 0x0409
usb 1-1: udev 2, busnum 1, minor = 1
usb 1-1: New USB device found, idVendor=8564, idProduct=4000
usb 1-1: New USB device strings: Mfr=3, Product=4, SerialNumber=5
usb 1-1: Product: GL3220
usb 1-1: Manufacturer: Genesys
usb 1-1: SerialNumber: 000000059
usb 1-1: usb_probe_device
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: adding 1-1:1.0 (config #1, interface 0)
uas 1-1:1.0: usb_probe_interface
uas 1-1:1.0: usb_probe_interface - got id
usb-storage 1-1:1.0: usb_probe_interface
usb-storage 1-1:1.0: usb_probe_interface - got id
usb-storage: USB Mass Storage device detected
usb-storage: -- associate_dev
usb-storage: Vendor: 0x8564, Product: 0x4000, Revision: 0x0008
usb-storage: Interface Subclass: 0x06, Protocol: 0x50
usb-storage: Transport: Bulk
usb-storage: Protocol: Transparent SCSI
scsi1 : usb-storage 1-1:1.0
usb-storage: *** thread sleeping.
hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
hub 1-0:1.0: port 1 enable change, status 00000503
usb-storage 1-1:1.0: device found
usb-storage 1-1:1.0: waiting for device to settle before scanning
usb-storage: usb_stor_control_msg: rq=fe rqtype=a1 value=0000 index=00 len=1
usb-storage: GetMaxLUN command result is 1, data is 2
usb-storage 1-1:1.0: scan complete

It stops there completely. If i plug the device into the USB1-Port, it works properly - so the msd-drivers should be all there. I tried forcing the usb2-port to use 12MHz to troubleshoot the cable, but that changed nothing.

Does anyone have an idea what to check next?

Thanks and Regards
Hannes


Replies (21)

RE: USB2.0 Host on MityDSP-L138F - Added by Bob Duke over 10 years ago

Hannes,

Can you upload your kernel .config file? We have seen similar problems on our 335x product line that were traced to an improper kernel configuration.

Thanks,

-Bob

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

Hi Bob,

Here's the file.

Thanks
Hannes

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

Could you post a full boot log? I'd like to compare it with what I'm getting. Also would be nice to see the connection log for the working port for comparison.

RE: USB2.0 Host on MityDSP-L138F - Added by Tim Iskander over 10 years ago

OT: Hannes, can you please double check your email address in your profile, I (admin) am getting bounced email warnings for every update to this thread.
thank you
/Tim Iskander

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

There you are.

That's the dmesg right after startup, with the card reader plugged in during startup. I enabled USB-MSD debug messages, so there's a bit more noise from that.

I'm also getting

udc_core: exports duplicate symbol usb_add_gadget_udc (owned by kernel)

during init, shortly after portmap starts. I'm not sure where that is coming from.

boot.log (15 KB) boot.log

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

Heres my bootlog. I'm having a hard time getting the mini usb working at all, in either host or peripheral mode. I haven't tried switching from PIO only to the DMA driver you enabled. Did you find that fixed something for you?

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

I tried changing between PIO and DMA before. That changed nothing about the problem - It enumerates the device and then stops.

Another thing:
If I plug in an external USB hub, the Linux detects that. Afterwards if i plug anything in, nothing happens.

But if i attach the hub with the device already plugged it, the Linux enumerates both devices. If i detach the device in the hub, the unplug doesn't get detected again.

I tried with a bunch of other devices (mostly USBHID). They also get detected and enumerated, the driver gets loaded, then nothing happens at all.

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

Ok I was able to get things to the point where it will atleast detect the insertion of the flash drive by changing the usb register from MUSB_OTG to MUSB_HOST. I suspect that this is where you are at.

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

Exactly. But the mass storage driver itself gets loaded and then stalls (no /dev/sd* gets created).

RE: USB2.0 Host on MityDSP-L138F - Added by Michael Williamson over 10 years ago

Wondering if this is perhaps a udev issue?

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

I don't think so. Udev primarily loads the driver and gets called once the driver does something. In the boot log you can see that the usb enumeration hangs during kernel initialization (usb is compiled in) and before init (and therefor udev) is running.

If I do the same on the ohci port, it works - including initilization of the usb-msd before init is running.

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

Got it working.

-# CONFIG_USB_SUSPEND is not set
+CONFIG_USB_SUSPEND=y
+CONFIG_USB_OTG=y
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set

I'll push a patch in a couple minutes.

RE: USB2.0 Host on MityDSP-L138F - Added by Bob Duke over 10 years ago

Hannes, please let us know if this resolves your issue. We actually fixed this same problem on our MitySOM-335x module a few days before you posted your question.

For the sake of those searching the forum in the future, the MitySOM-335x fix is in this commit.

Thanks for the detailed troubleshooting information.

-Bob

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

That changed stuff a bit. I now get more messages and the usb-msd driver seems to wake up.

But during initialization, i get error messages of disconnect and reconnect - see the attached log. I'm not sure whether the problem's in the cable or in the software. I'll only be able to check next week, hopefully with more information then.

Additionally, that patch seems to have made the ethernet of the device unusable. But that's not important right now.

dmesg.log (9.98 KB) dmesg.log

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

How were you experiencing the unstable ethernet? Just transferring a file?

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

Also you can buy the cables prebuilt.

USB mini 5 pin to USB A Female

http://www.amazon.com/USB-Female-Mini-Male-Adapter/sim/B0016RNX2I/2

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

I was able to scp a 12 MB file without any errors

RE: USB2.0 Host on MityDSP-L138F - Added by Jonathan Cormier over 10 years ago

When I enabled the dma I got the following errors when i plugged in the flash drive.

root@mityomapl138 ~ $ usb 1-1: new high-speed USB device number 2 using musb-hdrc
scsi1 : usb-storage 1-1:1.0

root@mityomapl138 ~ $ usb_rx_ch_teardown 1094: teardown Desc not found
usb 1-1: reset high-speed USB device number 2 using musb-hdrc
usb 1-1: reset high-speed USB device number 2 using musb-hdrc
usb 1-1: reset high-speed USB device number 2 using musb-hdrc
usb 1-1: reset high-speed USB device number 2 using musb-hdrc
usb 1-1: reset high-speed USB device number 2 using musb-hdrc
scsi 1:0:0:0: Device offlined - not ready after error recovery

So perhaps there is a problem with the dma driver as well. Can you try your device with PIO only set?

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

Hey again,

i tried changing it from DMA to PIO. Now, everything seems to work. Device is readable, writable and mountable. Performonce is ok - about 8MB/s either way.

The ethernet problem is gone. I'm not sure where the problem was. eth0 was up and had an IP, but it didn't send/receive anything on the network. Didn't try if ARP worked or not. But now it works again, so we're fine here.

RE: USB2.0 Host on MityDSP-L138F - Added by Michael Williamson over 10 years ago

If you don't mind, could you post your config.gz file?

RE: USB2.0 Host on MityDSP-L138F - Added by Hannes Klas over 10 years ago

There you are. Note that i had to change the initialization in the code as noted above.

config.gz (12.5 KB) config.gz
    (1-21/21)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)