Re: Raspberry Pi 3B Over-current USB

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Mon, 11 Apr 2022 09:10:02 UTC
On 4/9/22 20:04, Archimedes Gaviola wrote:
>   Hi,
> 
> I have a Prolific PL2303 USB-serial device when plugged-in to my Raspberry
> Pi 3B (14.0-CURRENT) will cause an over-current situation (enabled USB hub
> debugging hw.usb.uhub.debug=1) as observed in the dmesg below. All 4 ports
> got no power hence my USB keyboard was disconnected and stopped functioning
> and my PL2303 device wasn't able to get detected and load its uplcom(4)
> driver. However, the network is still okay in which I am able to access the
> system over SSH.
> 
> ukbd0: <A4Tech USB Keyboard, class 0/0, rev 2.00/1.05, addr 4> on usbus1
> kbd1 at ukbd0
> lo0: link state changed to UP
> smsc0: chip 0xec00, rev. 0002
> ue0: link state changed to DOWN
> ue0: link state changed to UP
> uhid0 on uhub1
> uhid0: <A4Tech USB Keyboard, class 0/0, rev 2.00/1.05, addr 4> on usbus1
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> uhub_explore: Overcurrent on port 2.
> uhub_reattach_port: reattaching port 4
> ugen1.4: <A4Tech USB Keyboard> at usbus1 (disconnected)
> ukbd0: at uhub1, port 4, addr 4 (disconnected)
> uhub_child_location: device not on hub
> uhub_child_pnpinfo: device not on hub
> ukbd0: detached
> uhid0: at uhub1, port 4, addr 4 (disconnected)
> uhub_child_location: device not on hub
> uhub_child_pnpinfo: device not on hub
> uhid0: detached
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> usb_needs_explore:
> usb_bus_powerd: bus=0xffff000089390000
> 
> Here's also the USB device info of my PL2303 device.
> 
> root@generic:~ # usbconfig -u 0 -a 5 dump_all_desc
>    ugen0.5: <Prolific Technology Inc. USB-Serial Controller> at usbus0,
> cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
>    bLength = 0x0012
>    bDescriptorType = 0x0001
>    bcdUSB = 0x0200
>    bDeviceClass = 0x0000  <Probed by interface class>
>    bDeviceSubClass = 0x0000
>    bDeviceProtocol = 0x0000
>    bMaxPacketSize0 = 0x0040
>    idVendor = 0x067b
>    idProduct = 0x2303
>    bcdDevice = 0x0300
>    iManufacturer = 0x0001  <Prolific Technology Inc.>
>    iProduct = 0x0002  <USB-Serial Controller>
>    iSerialNumber = 0x0000  <no string>
>    bNumConfigurations = 0x0001
> 
>   Configuration index 0
> 
>      bLength = 0x0009
>      bDescriptorType = 0x0002
>      wTotalLength = 0x0027
>      bNumInterfaces = 0x0001
>      bConfigurationValue = 0x0001
>      iConfiguration = 0x0000  <no string>
>      bmAttributes = 0x00a0
>      bMaxPower = 0x0032
> 
>      Interface 0
>        bLength = 0x0009
>        bDescriptorType = 0x0004
>        bInterfaceNumber = 0x0000
>        bAlternateSetting = 0x0000
>        bNumEndpoints = 0x0003
>        bInterfaceClass = 0x00ff  <Vendor specific>
>        bInterfaceSubClass = 0x0000
>        bInterfaceProtocol = 0x0000
>        iInterface = 0x0000  <no string>
> 
>       Endpoint 0
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0081  <IN>
>          bmAttributes = 0x0003  <INTERRUPT>
>          wMaxPacketSize = 0x000a
>          bInterval = 0x0001
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
>       Endpoint 1
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0002  <OUT>
>          bmAttributes = 0x0002  <BULK>
>          wMaxPacketSize = 0x0040
>          bInterval = 0x0000
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
>       Endpoint 2
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0083  <IN>
>          bmAttributes = 0x0002  <BULK>
>          wMaxPacketSize = 0x0040
>          bInterval = 0x0000
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
> I'm using a USB port measuring device that can check the voltage and
> current usages and by default (without any USB devices attached) each port
> reads as 5.15 volts and 0.00 amperes for current of 3B. I'm using the
> official Raspberry Pi Stontronics power adapter with 5.1V with 2.5A DC
> output https://docs.rs-online.com/0c30/0900766b814dc7bb.pdf. From here due
> to over-current, I cannot obtain the actual power consumptions specific to
> my PL2303 device so I try installing the latest Raspberry Pi OS to check if
> it behaves the same. I found out that it has a similar behavior and
> experience getting over-current with additional under-voltage detected
> messages. However, it's interesting to observe that even in an over-current
> and under-voltage experience, all the ports are re-powered up and
> functioning and then able to load the PL2303 driver and I am able to use it
> via /dev/ttyUSB0 device. This time I could see the measuring device giving
> a 4.93 volts with 0.46 amperes of current (460mA) in the PL2303 device (see
> captured measurement here https://filebin.net/kqq664yf9w70omnh). Below is
> the dmesg log I've got from RPi OS.
> 
> [ 7490.507686] usb 1-1-port2: over-current change #3
> [ 7490.722717] usb 1-1.2: USB disconnect, device number 5
> [ 7491.006607] hwmon hwmon1: Undervoltage detected!
> [ 7491.094482] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
> [ 7491.198613] usb 1-1.5: New USB device found, idVendor=067b,
> idProduct=2303, bcdDevice= 3.00
> [ 7491.198676] usb 1-1.5: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [ 7491.198700] usb 1-1.5: Product: USB-Serial Controller
> [ 7491.198722] usb 1-1.5: Manufacturer: Prolific Technology Inc.
> [ 7491.200210] pl2303 1-1.5:1.0: pl2303 converter detected
> [ 7491.206808] usb 1-1.5: pl2303 converter now attached to ttyUSB0
> [ 7491.209222] usb 1-1-port2: over-current change #4
> [ 7491.646484] usb 1-1.2: new low-speed USB device number 8 using dwc_otg
> [ 7491.770462] usb 1-1.2: New USB device found, idVendor=09da,
> idProduct=2267, bcdDevice= 1.05
> [ 7491.770515] usb 1-1.2: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [ 7491.770539] usb 1-1.2: Product: USB Keyboard
> [ 7491.770560] usb 1-1.2: Manufacturer: A4Tech
> [ 7491.793771] input: A4Tech USB Keyboard as
> /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:09DA:2267.0004/input/input6
> [ 7491.852612] hid-generic 0003:09DA:2267.0004: input,hidraw0: USB HID
> v1.11 Keyboard [A4Tech USB Keyboard] on usb-3f980000.usb-1.2/input0
> [ 7491.875068] input: A4Tech USB Keyboard as
> /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:09DA:2267.0005/input/input7
> [ 7491.935697] hid-generic 0003:09DA:2267.0005: input,hidraw1: USB HID
> v1.11 Device [A4Tech USB Keyboard] on usb-3f980000.usb-1.2/input1
> [ 7495.038507] hwmon hwmon1: Voltage normalised
> 
> Though this experience is specific to the Raspberry 3B case, is there a way
> to enable this in FreeBSD? Knowing that there is dropping of voltage to
> 4.93 volts and current is 460mA which is still below the maximum of 500mA?
> 

You need an external self-powerd USB HUB.

--HPS