i.MX6 ULL based device sometimes can't open USB camera - camera

We are attempting to debug an issue that we are seeing with some devices where the camera module starts/stops working sometimes after a power cycle. A working camera can stop working and a non working camera can start working without any change to the device.
With the devices that no longer take photos we get messages as shown below in the kernel log:
[ 20.153600] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 20.398490] usb 1-1: unable to read config index 0 descriptor/all
[ 20.403538] usb 1-1: can't read configurations, error -32
[ 20.543572] usb 1-1: new high-speed USB device number 3 using ci_hdrc
[ 20.746370] usb 1-1: device descriptor read/all, error -71
[ 20.883987] usb 1-1: new high-speed USB device number 4 using ci_hdrc
[ 21.333593] usb 1-1: device not accepting address 4, error -71
some other devices will show
[ 20.243591] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 20.448903] usb 1-1: unable to read config index 0 descriptor/start: -32
[ 20.454553] usb 1-1: chopping to 0 config(s)
[ 20.478077] usb 1-1: no configuration chosen from 0 choices
On the functioning devices we see this instead
[ 19.933590] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 20.294390] uvcvideo: Found UVC 1.00 device MikrOkularFullHD (053a:9230)
[ 20.308968] input: MikrOkularFullHD as /devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb1/1-1/1-1:1.0/input/input1
[ 20.320578] evbug: Connected device: input1 (MikrOkularFullHD at usb-ci_hdrc.1-1/button)
[ 20.327982] usbcore: registered new interface driver uvcvideo
[ 20.332528] USB Video Class driver (1.1.1)
We've tried rebooting the device, leaving it off for a few minutes then turning it back on (in case overcurrent was the issue) - but none of that has worked so far.
We are running Linux version 4.9.11-1.0.0+gc27010d

May be a power supply issue. Just use a powered usb hub to see if there are no problems.
If this resolves the issue, try to increase the capacitor in the usb power rail.

Related

STM32H743 with USB HS, FUSB2805 not detected

I have a custom board with STM32H743VIT6 connected to an external USB HS PHY, the FUSB2805MLX.
I am trying to run a bare minimum example setup in STM32CubeMx. Just including a USB HS connection and the device in USB VCP mode.
The pin setup is correct, and the external clocks on the PHY are correct (26MHz in, generates 60MHz on CLK line between MCU and PHY).
I can see that the 60Mhz line is shut down after the call to USBD_Start(&hUsbDeviceHs)
The data lines are pulled high at the same time.
The relevant pinout is:
PA3 -> USB_OTG_HS_ULPI_DO
PA5 -> USB_OTG_HS_ULPI_CK
PB0 -> USB_OTG_HS_ULPI_D1
PB1 -> USB_OTG_HS_ULPI_D2
PB5 -> USB_OTG_HS_ULPI_D7
PB10 -> USB_OTG_HS_ULPI_D3
PB11 -> USB_OTG_HS_ULPI_D4
PB12 -> USB_OTG_HS_ULPI_D5
PB13 -> USB_OTG_HS_ULPI_D6
PC0 -> USB_OTG_HS_ULPI_STP
PC2_C -> USB_OTG_HS_ULPI_DIR
PC3_C -> USB_OTG_HS_ULPI_NXT
However, i cannot get this to work.
The code runs without errors and debugging through it doesn't give me any idea of what might be wrong. All functions return with HAL_OK
The computer does not detect the USB device.
sudo dmesg | grep usb gives the following output
[27482.966148] usb usb3-port7: attempt power cycle
[27483.622018] usb 3-7: new low-speed USB device number 32 using xhci_hcd
[27483.622532] usb 3-7: Device not responding to setup address.
[27483.830337] usb 3-7: Device not responding to setup address.
[27484.041933] usb 3-7: device not accepting address 32, error -71
[27484.173925] usb 3-7: new low-speed USB device number 33 using xhci_hcd
[27484.174414] usb 3-7: Device not responding to setup address.
[27484.382364] usb 3-7: Device not responding to setup address.
[27484.589893] usb 3-7: device not accepting address 33, error -71
[27484.590002] usb usb3-port7: unable to enumerate USB device
[81863.025532] usb 3-3: reset full-speed USB device number 3 using xhci_hcd
[82185.873876] usb 3-3: reset full-speed USB device number 3 using xhci_hcd
[82306.336339] usb 3-3: reset full-speed USB device number 3 using xhci_hcd
[82758.471075] usb 3-3: reset full-speed USB device number 3 using xhci_hcd
It's the same using the USB_DEVICE Middleware in Mass Storace Class mode.
Are there any tricks to getting ULPI USB HS to work on this MCU?

NVIDIA Jetson TX2: Usb 2-3-port2: Cannot enable: Maybe the USB cable is bad?

I am using NVIDIA Jetson TX2 and I need to connect a camera to the usb port in the title. Once I connect the device to the usb port for the first time (no matter if before or after booting), I get the following error:
[ 383.132664] usb 2-3.4: new SuperSpeed USB device number 3 using tegra-xusb
[ 383.153326] usb 2-3.4: New USB device found, idVendor=8086, idProduct=0b3a
[ 383.153367] usb 2-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 383.153374] usb 2-3.4: Product: Intel(R) RealSense™ Depth Camera 435i
[ 383.153379] usb 2-3.4: Manufacturer: Intel(R) RealSense™ Depth Camera 435i
[ 383.153385] usb 2-3.4: SerialNumber: 045323051018
[ 387.232712] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 391.308686] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 395.380654] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 399.452674] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 403.524704] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 407.596712] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 411.668625] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
Not only does this compromise the camera, but also all the other usb devices (e.g. the mouse and the keyboard are no longer able to work properly)
If i unplug the camera and I plug it in again, everything seems to be working:
[ 411.668970] usb 2-3.4: USB disconnect, device number 3
[ 415.884647] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 419.956664] usb 2-3-port2: Cannot enable. Maybe the USB cable is bad?
[ 420.180536] usb 2-3.4: new SuperSpeed USB device number 4 using tegra-xusb
[ 420.201212] usb 2-3.4: New USB device found, idVendor=8086, idProduct=0b3a
[ 420.201226] usb 2-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 420.201232] usb 2-3.4: Product: Intel(R) RealSense™ Depth Camera 435i
[ 420.201238] usb 2-3.4: Manufacturer: Intel(R) RealSense™ Depth Camera 435i
[ 420.201243] usb 2-3.4: SerialNumber: 045323051018
[ 420.262547] uvcvideo: Unknown video format 00000050-0000-0010-8000-00aa00389b71
[ 420.262585] uvcvideo: Unknown video format 00000032-0000-0010-8000-00aa00389b71
[ 420.263360] uvcvideo: Found UVC 1.50 device Intel(R) RealSense™ Depth Camera 435i (8086:0b3a)
[ 420.276804] uvcvideo: Unable to create debugfs 2-4 directory.
[ 420.277447] uvcvideo 2-3.4:1.0: Entity type for entity Intel(R) RealSense™ Depth Ca was not initialized!
[ 420.277659] uvcvideo 2-3.4:1.0: Entity type for entity Processing 2 was not initialized!
[ 420.277800] uvcvideo 2-3.4:1.0: Entity type for entity Intel(R) RealSense™ Depth Ca was not initialized!
[ 420.277963] uvcvideo 2-3.4:1.0: Entity type for entity Camera 1 was not initialized!
[ 420.278642] input: Intel(R) RealSense™ Depth Ca as /devices/3610000.xhci/usb2/2-3/2-3.4/2-3.4:1.0/input/input9
[ 420.278924] uvcvideo: Unknown video format 36315752-1a66-a242-9065-d01814a8ef8a
[ 420.278940] uvcvideo: Found UVC 1.50 device Intel(R) RealSense™ Depth Camera 435i (8086:0b3a)
[ 420.282469] uvcvideo: Unable to create debugfs 2-4 directory.
[ 420.284465] uvcvideo 2-3.4:1.3: Entity type for entity Processing 7 was not initialized!
[ 420.284649] uvcvideo 2-3.4:1.3: Entity type for entity Extension 8 was not initialized!
[ 420.284804] uvcvideo 2-3.4:1.3: Entity type for entity Camera 6 was not initialized!
[ 420.285465] usbcore: registered new interface driver uvcvideo
[ 420.285471] USB Video Class driver (1.1.1)
[ 426.256314] usb 2-3.4: usb_suspend_both: status 0
[ 426.304304] usb 2-3: usb_suspend_both: status 0
[ 426.304472] usb usb2: usb_suspend_both: status 0
Plus, if I connect the device to another usb port everything works fine since the very first tentative. However, this is not a solution, since I need to connect the camera to that specific usb port for practical reasons. Did anyone run into this issue? Does anyone know how to help me?
I frequently run into usb issues when using the dji manifold 2 with its usb ports (as well as with the usb extension hub)
The trick i used is simply to plug everything in first, before turning the device on. It seemed to have worked for me. You may want to try that too. While this is not a permanent fix, I hope it will work for you

how to hotplug USB device on Qemu 4.2.0?

I have Qemu 4.2.0 with Debian Testing Bullseye and Kernel 5.4.0 and I need to hotplug and unplug an USB device.
Currently I attach my USB device with
qemu... -usb -device usb-host,hostbus=x,hostaddr=y
but when I physically remove the device I can't longer detect it from within the VM (Win7).
So, what should I do to send a plug/unplug usb signal to the virtual machine??
You can do plug/unplug via qemu monitor. see https://en.wikibooks.org/wiki/QEMU/Monitor.
To hot plug a usb device, type bellow in qemu monitor:
(qemu) device_add usb-host,hostbus=2,hostport=1.2.2,id=idofyourdevice
To remove a usb device, type bellow in qemu monitor:
(qemu) device_del idofyourdevice

Getting Hotplug react when plugging 3G netstick (with mdev)

I'm trying to get a device running embedded linux V-2.6.31 to automatically recognize when a Huawei 3G usb stick is plugged to it, run usb_modeswitch, and communicate with the module.
it seems that usb_modeswitch doesn't work well in a system that has mdev, since the path /dev/bus/usb is only being created with udev.
I found a script that create this path and enable usb_modeswitch to work properly.
now, all i need is automation of this process, e.g., when plugging the 3G module, hotplug will first call my script, and then usb_modeswitch.
the problem is that when plugging the 3G module nothing happens when the enumeration is done (the hotplug wont run), see trace:
[83175.520000] usb 2-1: new full speed USB device using bcm5892-ohci:PORT-2 and address 3
[83175.730000] usb 2-1: not running at top speed; connect to a high speed hub
[83175.750000] usb 2-1: New USB device found, idVendor=12d1, idProduct=1f1c
[83175.760000] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[83175.770000] usb 2-1: Product: HUAWEI Mobile
[83175.770000] usb 2-1: Manufacturer: Vodafone(Huawei)
[83175.780000] usb 2-1: SerialNumber: FFFFFFFFFFFFFFFF
[83175.800000] usb 2-1: configuration #1 chosen from 2 choices
[83175.870000] scsi1 : SCSI emulation for USB Mass Storage devices
[83180.910000] scsi 1:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
I'm not sure what is wrong, is there something i didn't enable? is there a KO that i need to load in order for it to work?
Thank you in advance!

USB on embedded Linux - TI hub TUSB2046B doesn't detect USB devices

I have a problem on embedded platform with very limited toolchain. I have TI Hub connected to USB host on chip. This hub seems to be detected properly, but sierra wireless SL6087 device that I connect to it, doesn't appear in system. Unfortunately I can't use USB Device Filesystem - I have no /proc/bus/usb. What I can do is read /sys direct.
I get following system log with and without modul connected. I also don't see any communication on D+ and D- lines. kernel 2.6.21.
# dmesg | grep -e hub -e usb
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
usbmon: debugfs is not available
rt3xxx-ohci rt3xxx-ohci: roothub.a 02000202 POTPGT=2 NPS NDP=2(2)
rt3xxx-ohci rt3xxx-ohci: roothub.b 00000000 PPCM=0000 DR=0000
rt3xxx-ohci rt3xxx-ohci: roothub.status 00008000 DRWE
rt3xxx-ohci rt3xxx-ohci: roothub.portstatus [0] 0x00000100 PPS
rt3xxx-ohci rt3xxx-ohci: roothub.portstatus [1] 0x00000100 PPS
usb usb1: default language 0x0409
usb usb1: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: RT3xxx OHCI Controller
usb usb1: Manufacturer: Linux 2.6.21 ohci_hcd
usb usb1: SerialNumber: rt3xxx-ohci
usb usb1: uevent
usb usb1: usb_probe_device
usb usb1: configuration #1 chosen from 1 choice
usb usb1: adding 1-0:1.0 (config #1, interface 0)
usb 1-0:1.0: uevent
hub 1-0:1.0: usb_probe_interface
hub 1-0:1.0: usb_probe_interface - got id
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
hub 1-0:1.0: standalone hub
hub 1-0:1.0: no power switching (usb 1.0)
hub 1-0:1.0: global over-current protection
hub 1-0:1.0: power on to power good time: 4ms
hub 1-0:1.0: local power source is good
hub 1-0:1.0: no over-current condition exists
hub 1-0:1.0: trying to enable port power on non-switchable hub
hub 1-0:1.0: state 7 ports 2 chg 0000 evt 0000
usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for Sierra USB modem
usbcore: registered new interface driver sierra
drivers/usb/serial/sierra.c: USB Driver for Sierra Wireless USB modems: v.1.7.40
Check your VBUS. Are you getting the +5V going to your devices?
When you connect the device, is there any log file change? These are the things I would try. Sometimes it is as simple as following an enable/reset line on the schematic and setting a GPIO properly.
NOTE: If you do get a log file change when you insert the device, then you probably are just missing the other side of the process; the driver.