WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: libusb not showing devices  (Read 4472 times)

Offline kkrpeq

  • Newbie
  • *
  • Posts: 7
libusb not showing devices
« on: April 13, 2022, 08:49:01 PM »
Hello,

I am trying to use piCore on a RPi 02W to perform usb communication with an usb 2.0 device.
However, libusb was not able to find any device I connected to the RPi. The output of "sudo lsusb" shows only the built in usb hub,  and not my device:

Protocol spec without prior Class and Subclass spec at line 23179
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

"sudo lsusb -t" and "dmesg" also show only the hub.

Am I missing something?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: libusb not showing devices
« Reply #1 on: April 14, 2022, 02:19:09 AM »
No, any drivers missing would not affect lsusb or dmesg. You have a physical problem with the connection, power, or usb device.
The only barriers that can stop you are the ones you create yourself.

Offline kkrpeq

  • Newbie
  • *
  • Posts: 7
Re: libusb not showing devices
« Reply #2 on: April 15, 2022, 12:58:28 AM »
I have been doing some tests with two usb devices, namely DeviceA and DeviceB. I know they both work because I can use them on Mac and Windows.

If I plug in DeviceA, the RPi recognizes it as expected, and the device works properly.
If I plug in DeviceB, the RPi stops recognizing usb devices. Even if I remove DeviceB and insert DeviceA, it will not recognize anything.

Upon further inspection, it seems the RPi is cutting off the power to the usb devices whenever I insert (or try to use) DeviceB. I am verifying this by using this command:

Code: [Select]
cat /sys/devices/platform/soc/3f980000.usb/buspower
Bus Power = 0x0

I can turn the power on by writing 0x1 to buspower:

Code: [Select]
echo 0x1 > /sys/devices/platform/soc/3f980000.usb/buspower
But it will turn off again if DeviceB is connected.
I have tried using an external/exclusive power supply for DeviceB, but it still didn't work.
Is there any option in config.txt, bootcode, or something similar that might help?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: libusb not showing devices
« Reply #3 on: April 15, 2022, 01:28:21 AM »
Hi kkrpeq
... I have tried using an external/exclusive power supply for DeviceB, but it still didn't work. ...
Not sure what you mean by that.

Try placing a powered hub between  DeviceB  and your  RPi .

Offline kkrpeq

  • Newbie
  • *
  • Posts: 7
Re: libusb not showing devices
« Reply #4 on: April 15, 2022, 01:58:38 AM »
... I have tried using an external/exclusive power supply for DeviceB, but it still didn't work. ...
Not sure what you mean by that.

I used an usb adapter that has an auxiliary power inlet. The +5V supplied to the usb device does not come from the RPi, instead it comes from another power supply.
It is like a powered hub, but without the "hub" part. Here is a picture of the adapter:



Try placing a powered hub between  DeviceB  and your  RPi .

I just tried using an actual powered hub. Strangely enough, the hub shows the same behaviour as DeviceB: when I connect the hub to the RPi (even if the hub has no devices connected to it), Bus Power is automatically set to 0x0.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: libusb not showing devices
« Reply #5 on: April 15, 2022, 02:51:31 AM »
edit: Seems your rpi's usb could be broken, if the hub alone shows the same behavior. Try another rpi?
The only barriers that can stop you are the ones you create yourself.

Offline kkrpeq

  • Newbie
  • *
  • Posts: 7
Re: libusb not showing devices
« Reply #6 on: April 15, 2022, 04:18:36 AM »
I added dwc_otg.speed=1 at the end of my cmdline.txt, and now DeviceB is being detected by lsusb. Also, Bus Power was not automatically set to 0x0.
However this parameter limits the usb speed to only 12Mbps, while usb 2.0 can do up to 480Mbps.
Maybe there is a better solution?

References:

https://raspberrypi.stackexchange.com/questions/1886/what-kernel-parameters-are-available-for-fixing-usb-problems

https://www.cl.cam.ac.uk/~atm26/ephemeral/rpi/dwc_otg/doc/html/module%20parameters.html

Offline gadget42

  • Hero Member
  • *****
  • Posts: 780
Re: libusb not showing devices
« Reply #7 on: April 15, 2022, 06:23:49 AM »
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline kkrpeq

  • Newbie
  • *
  • Posts: 7
Re: libusb not showing devices
« Reply #8 on: April 16, 2022, 01:53:19 AM »
What bugs me the most is that I got DeviceB working on Raspberry OS a few times before, so I thought the problem was a tiny core issue.
But now I tried Raspberry OS again and it shows the same problem.
While setting dwc_otg.speed=1 succeeded in making DeviceB recognizable by lsusb, I am having errors when performing bulk transfers.  :(

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: libusb not showing devices
« Reply #9 on: April 16, 2022, 10:43:31 AM »
Hi kkrpeq
I sounds like it may be a power supply issue for the RPi. It could be the power supply is failing and no longer providing
a stable output. Or maybe something on the RPi changed causing it to pull more current than it used to.

Try reducing the power consumption by lowering the CPU frequency. Then see if the USB system behaves any better.

Install cpupower.tcz:
Code: [Select]
tce-load -wi cpupower
Then:
Check the info:
Code: [Select]
cpupower frequency-info
Set the governor to userspace so that we can set the frequency:
Code: [Select]
sudo cpupower frequency-set --governor userspace
Set the maximum frequency:
Code: [Select]
sudo cpupower frequency-set --max 600MHz
Check the info:
Code: [Select]
cpupower frequency-info.It should say: "Current policy: frequency should be within 600 MHz and 600 MHz."

Found here:
https://raspberrypi.stackexchange.com/a/133666


Offline kkrpeq

  • Newbie
  • *
  • Posts: 7
Re: libusb not showing devices
« Reply #10 on: April 16, 2022, 05:46:42 PM »
Without changing any setting, I tried it again with tiny core and the powered hub, and now it worked. I changed only the way the cables are connected maybe? Indeed it looks like a hardware/circuitry/power issue.

Try reducing the power consumption by lowering the CPU frequency. Then see if the USB system behaves any better.

Thanks for the tutorial. I can see the message "Current policy: frequency should be within 600 MHz and 600 MHz", however DeviceB still isn't recognized when I connect it directly to the RPi.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: libusb not showing devices
« Reply #11 on: April 16, 2022, 07:45:58 PM »
Hi kkrpeq
... I changed only the way the cables are connected maybe? ...
I looked up the specs for the  RPi 02W.  It lists 2 micro USB ports. One is used to power up the RPi, the other is for
data transfers. They are not interchangeable.

Also, the powered hub should have it's own power supply, separate from the one powering the RPi.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: libusb not showing devices
« Reply #12 on: April 17, 2022, 08:30:23 PM »
The bulk transfer issue is likely something completely different.  With exception of the rpi4 , all rpi boards suffer from a usb flaw.

I would try this on command line.

dwc_otg.fiq_fsm_mask=0xF dwc_otg.lpm_enable=0


Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 709
Re: libusb not showing devices
« Reply #13 on: April 18, 2022, 02:26:09 AM »
Isn't the flaw that the usb control circuit shares the same circuit with the ethernet.
So my hypothesis is, if you have a raspberry pi without the ethernet it should be fine.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: libusb not showing devices
« Reply #14 on: April 18, 2022, 06:42:54 AM »
No,  the flaw is in the usb design.  The flaw is accentuated if you have high Ethernet throughput and usb throughout.

Without The FIQ handler, even a keyboard connected to usb can be glitchy.