USB Harddisk on Colibri iMX7 running Linux

Hi,

we are having some difficulties getting a USB harddisk to work with the Colibri iMX7 running under Linux. Our environment is as follows:

  • Colibri iMX7 dual core auf Colibri Evaulation Board
  • Linux installiert mit EasyInstaller: Toradex-Embedded Linux Console Demo 2.8b3.111
  • USB harddisk powered by USB host

If the system is up and running, we can connect the HD and it works. If we connect the HD before powering the eval board, the USB device does not always get enumerated. The output of dmesg related to this problem is:

[    2.593986] systemd[1]: Reached target Swap.
[    2.623435] systemd[1]: Listening on udev Kernel Socket.
[    2.643196] usb 1-1: USB disconnect, device number 2
[    2.650506] usb usb1-port1: cannot reset (err = -32)
[    2.657185] usb usb1-port1: cannot reset (err = -32)
[    2.665063] systemd[1]: Created slice system-serial\x2dgetty.slice.
[    2.673438] usb usb1-port1: cannot reset (err = -32)
[    2.680600] usb usb1-port1: cannot reset (err = -32)
[    2.687528] usb usb1-port1: cannot reset (err = -32)
[    2.697092] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[    2.707334] systemd[1]: Created slice User and Session Slice.
[    2.715368] usb usb1-port1: cannot reset (err = -32)
[    2.721786] usb usb1-port1: cannot reset (err = -32)
[    2.730954] usb usb1-port1: cannot reset (err = -32)
[    2.739416] usb usb1-port1: cannot reset (err = -32)
[    2.745606] usb usb1-port1: cannot reset (err = -32)
[    2.751723] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[    2.759447] usb usb1-port1: attempt power cycle
[    2.783500] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    3.103198] usb usb1-port1: cannot reset (err = -32)
[    3.109325] usb usb1-port1: cannot reset (err = -32)
[    3.115418] usb usb1-port1: cannot reset (err = -32)
[    3.121429] usb usb1-port1: cannot reset (err = -32)
[    3.127421] usb usb1-port1: cannot reset (err = -32)
[    3.133344] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[    3.140900] usb usb1-port1: cannot reset (err = -32)
[    3.146834] usb usb1-port1: cannot reset (err = -32)
[    3.152730] usb usb1-port1: cannot reset (err = -32)
[    3.158751] usb usb1-port1: cannot reset (err = -32)
[    3.167873] usb usb1-port1: cannot reset (err = -32)
[    3.175478] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[    3.183141] usb usb1-port1: unable to enumerate USB device
[    3.472855] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

In that state no USB devices will get enumerated, on all 4 ports. The system must be rebootet for the USB host to be working again.

For testing purposes I have tried the same with a Tegra T30 module running Windows on the same eval board. Under Windows the HD is always mounted without problems.

Furthermore I have noticed, that under Linux the HD will be mounted correctly, if during boot process a mouse is connected to the USB host (in addition to the HD). I have seen this per coincidence, because I had the mouse still connected to be able to work with the Windows running on the Tegra module.

Are there any known issues related to USB HD connected already at power-on under Linux?

Can you reproduce the behaviour?

hi @arnold_gemac

The Bsp 2.8b3 is not supported anymore, please update to 2.8b4 as your earliest convenience.

Concerning your issue, could you provide the following details:

  • Hardware version of the carrier board?
  • Complete dmesg log in a file in working and non working state
  • output of lsusb in working and non working state
  • Datasheet of the USB Harddisk

Can you reproduce the behaviour?

We haven’t seen a issue like that till now.

Could you try with a different usb cable/port and also connect the harddisk using an external Hub? Do you have the same error then?

Best regards, Jaski

,Hi,

I have installed the image 2.8b4.129 (2018-10-05), but the issue remains. Complete dmesg and lsusb logs are attached.

Hardware version of carrier board: V3.2B

Type of harddisk: IO Data HDPX-UTS1K
Unfortunately I am not able to find a data sheet. It is an external 2,5" USB 3.0 drive, connected via micro USB 2.0 cable. Last week I have tried it with another external 2,5" harddisk of a colleague, that showed the same behaviour, but I have not noticed the type of this HD.

Connecting the HD via self-powered hub did not solve the problem.

I have also tried with a 3,5" HD, powered via mains. Same behaviour here.

With a USB memory stick, I have tested, the error does not occur.

Using other cable or port does not solve the problem. I have tried all4 USB ports and I have tried even with a USB 3 cable (with the wider connector).

The behaviour is reproducible.
link text

The issue can be driver or power related.

Could you share the dmesg log when you connect the Harddisk to the board when linux is already up? Don’t connect anything else to the Board. Share also the output of lsmod once you connected the harddisk!

Both files are attached.

For your information, I have made some further tests with 2 more external HDs.

A Western Digital WD 25A1 (3 TB, USB 3.0) does have the same problem.

An older HD of type Western Digital WD 3200BEV (320 GB, USB 2.0) works, even if connected already at power-on.link text

Thanks for the files. Could you check for the current consumption (dynamic and static) of different harddisks? If will be also helpful, if you could measure the USB_5V power supply during startup with connected harddisk or when the harddisk is being connected to the USB once linux is already started?

It is difficult to measure the current without affecting the function of the HD…

But for testing I have connected the input of the USB device power switch (TPS2502) directly to the +5V line of the USB connector with a wire. The over-current function of the switch is then no longer working. By doing so the HD is recognized and mounted correctly, even if connected at power-on. Obviously we get into a situation, where the electrical characteristics of the power-switch already have negative impact on the HD (maybe voltage drop???) without activating its over-current switch. As a result the whole USB hub is no longer working.

Questions remaining for me are:

Why is this happening only, if the HD is connected at power-on?

Is there a way to tell the kernel, that it should enable the power switches at a later moment, when the system has booted up?

But for testing I have connected the input of the USB device power switch (TPS2502) directly to the +5V line of the USB connector with a wire. The over-current function of the switch is then no longer working. By doing so the HD is recognized and mounted correctly, even if connected at power-on. Obviously we get into a situation, where the electrical characteristics of the power-switch already have negative impact on the HD (maybe voltage drop???) without activating its over-current switch. As a result the whole USB hub is no longer working.

Actually the Problem is that the most USB Harddisks are not USB Complaint. Usually they consume more than 0.5A Current(especially during power-on step) which is the maximum for USB2.0. At the Startup of the module, this is critical, since the module consumes also which can lead to voltage drop at 5V and thus 5V for USB.

On the Colibri Evaluation Board, for each port of the integrated USB Hub, there is Power switch with overcurrent Protection. If there is overcurrent condition, then this overcurrent flag is sent to the USB Hub, which deactivates then all the USB Ports. In your case, either you can shorten the power switch for the Port where the USB Harddisk is connected as you already did, then you won’t have any overcurrent protection. Or you can cut the OC Flag line to the USB Hub, thus there will be no Information to the HUB and also no deactivation of the Outputs.
Please Notice, that you won’t be USB Complaint in both cases.

Is there a way to tell the kernel, that it should enable the power switches at a later moment, when the system has booted up?

Maybe this is possible using the I2C Communication to the Hub, but we never did this.

I have made further tests with another current switch. I have replaced the TPS2051 by the compatible TPS2065, that has a continuous current of 1 Ampere instead of 0.5A. But the problem still persists. I am wondering, why I am having this difficulties. I have tested now 5 hard disks, 4 of them had the problem, only 1 of them worked, and that was the old USB 2.0 harddisk. It seems quiet unlikely to me, that I am the only one, that encounters this problem. I am using original Toradex hardware and the unmodified image from your server.

Could you at least reproduce the problem?

I have made some more tests with different types of USB mass storage devices:

  • 2 different types of USB3-Sticks show the same problem.
  • 2 different types of USB2-Sticks do work, even on the 500mA-Power-Switch
  • 1 SATA-HD connected via USB3-to-SATA-Adapter works (bus-powered)

Hi, Thanks for this Information.
Could you give details of the USB3 Sticks? Could you check if the OverCurrent Flag line is raised to the USB Hub or not?

  • Stick #1: SanDisk Ultra Flair USB 3.0 32GB (VID 0781, PID 5591)
  • Stick #2: SanDisk Corp. Ultra Fit 32 GB (VID 0781, PID 5583)

The overcurrent line is inactive. The LEDs, that indicate the state of the power-switch, are all ON.

I don’t know, if the Linux driver re-enables a power switch, if it detects an overcurrent situation, but in earlier tests I have never seen a transition on the overcurrent line, even when watched with the scope.

As mentioned in one of my earlier posts, the whole hub is not working in that state! No USB device, I connect to it in that state, is working. The hub itself is NOT listed by the lsusb command:

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

When booting up with nothing connected to the hub, lsusb gives me:

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

hi @arnold_gemac

Thanks for the Information. I have tried this with 1 USB3 Stick and a USB Harddisk. I could not reproduce the Issue.

Could you share the details (Voltage and Current) of your power supply for the Eval Board?

12V, 2.5A
It is the one from the Carrier Board Accessory Kit (Carrier Board Accessory Kit | Toradex Developer Center).

I have tried another USB2-Memory-Stick, type “Alcor Micro Corp. Flash Drive”. It does not work too, when connected at power-on already.

Because of the relative large amount of different devices, that show this problem, it should be easy for you to reproduce the issue. Was it a USB3 harddisk, that you have tested or USB2?

Could you please tell me, what is the state of this issue at your side?

On our side I tried a USB3 Stick from Kingston and a Usb 2.0 Harddisk from Western Digital. Both worked fine, also after reboots. So currently we are not able to reproduce your issue.

However we will do more tests and come next week to you.
Best regards, Jaski

hi @arnold_gemac

Finally we were able to reproduce the issue. The USB3.0 Harddisk (Western Digital My Passport Ultra) is not found at Cold Boot when it is the only device connected to the USB Hub on Evaluation Board. Also connecting/disconnecting the Harddisk is not recognized by the Software.

If you connect anything additionally to the HUB, then the USB3.0 Harddisk is found without any Issues.

For the moment, you could connect the harddisk which are not working to an external USB 3.0 Hub. This works perfectly on our side.

Or you can connect the non working harddsik to the OTG Port by using the following connector. This works also perfectly.

Best regards, Jaski

Thanks for this information. Unfortunately the workarounds suggested by you are not an option for us. Let me tell you why.

We already have a design, that is mostly compatible to your eval board (and that therefore shows the same problems as the eval board related to USB3 hard disks). In that design we have connected a microcontroller to the USB OTG port, so this port is not available. The harddisk shall be connected to one of the 4 downstream ports of the hub. We have a dedicated connector for the HD, the HD itself is mounted inside the same case as the electronics. The case for the hardware is limited in size, so we are not able to mount another USB hub between the on-board hub and the HD.

Do you have an idea, what is the reason for this behaviour? How should we handle this issue? The feature is essential for our application. So we would like to know, how this issue is handled by Toradex. Can we hope for a fix “in the near future”?

hi @arnold_gemac

Thanks for this Information. We are looking into this Issue and will come back to you soon.
Best regards, Jaski

hi @arnold_gemac: Is this issue still present or did you find a different solution? Could you check please if you still having this issue with the newest Bsp 2.8?