Re: Raspberry Pi 3B Over-current USB

From: Archimedes Gaviola <archimedes.gaviola_at_gmail.com>
Date: Mon, 11 Apr 2022 13:59:08 UTC
On Mon, Apr 11, 2022 at 5:10 PM Hans Petter Selasky <hps@selasky.org> wrote:

> 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.
>

Hi Hans,

Noted on the self-powered hub, thanks for the suggestion, I will try.

Just wanted to share the observation from the testing I've conducted with
my Raspberry Pi 4B with the same 14.0-CURRENT to check if overcurrent is
also experienced and it did, there was overcurrent and each ports' power
shut-off during the situation but it was able to recover back. I initiated
the command 'usbconfig reset' and each port gloriously came back alive one
by one and loaded my USB keyboard and Prolific uplcom(4) drivers into
functional and operational states. My measuring device is showing the same
amount of current 460mA while the voltage stayed at 5.05 from a baseline of
5.15 volts https://filebin.net/10vy575q6h2yl8og. Unlike my RPi 3B, voltage
dropped to 4.93 from a baseline of 5.19 volts. So, the difference I
observed is when the voltage dropped below 5, the system will not give a
chance to make the ports come back alive as a sort of protection mechanism.
Sharing to you the logs below (with hw.usb.uhub.debug=1).

usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
uhub_reset_tt_callback: TT buffer reset
uhub_reset_tt_callback: TT buffer reset
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
uhub_reattach_port: reattaching port 2
ugen0.3: <A4Tech USB Keyboard> at usbus0 (disconnected)
ukbd0: at uhub1, port 2, addr 2 (disconnected)
uhub_child_location: device not on hub
uhub_child_pnpinfo: device not on hub
ukbd0: detached
uhid0: at uhub1, port 2, addr 2 (disconnected)
uhub_child_location: device not on hub
uhub_child_pnpinfo: device not on hub
uhid0: detached
uhub_explore: Overcurrent on port 3.
uhub_explore: Overcurrent on port 4.
uhub_explore: Overcurrent on port 2.
uhub_explore: Overcurrent on port 3.
uhub_explore: Overcurrent on port 4.
uhub_explore: Overcurrent on port 5.
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
uhub_explore: Overcurrent on port 1.
uhub_explore: Overcurrent on port 2.
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
uhub0: at usbus0, port 1, addr 1 (disconnected)
ugen0.2: <vendor 0x2109 USB2.0 Hub> at usbus0 (disconnected)
uhub1: at uhub0, port 1, addr 1 (disconnected)
uhub_child_location: device not on hub
uhub_child_pnpinfo: device not on hub
uhub1: detached
uhub0: detached
uhub0 on usbus0
uhub0: <(0x1106) XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
uhub_attach: turn on port 1 power
uhub_attach: turn on port 2 power
usb_needs_explore:
uhub_attach: turn on port 3 power
uhub_attach: turn on port 4 power
uhub_attach: turn on port 5 power
uhub0: 5 ports with 4 removable, self powered
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
uhub_reattach_port: reattaching port 1
uhub_reattach_port: Port 1 is in Host Mode
usb_needs_explore:
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
ugen0.2: <vendor 0x2109 USB2.0 Hub> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x2109 USB2.0 Hub, class 9/0, rev 2.10/4.20, addr 1> on
usbus0
uhub_attach: turn on port 1 power
uhub_attach: turn on port 2 power
uhub_attach: turn on port 3 power
uhub_attach: turn on port 4 power
uhub1: 4 ports with 4 removable, self powered
usb_needs_explore:
usbd_transfer_power_ref: Adding type 3 to power state
usbd_transfer_power_ref: needs power
uhub_explore: Overcurrent on port 1.
uhub_reattach_port: reattaching port 1
uhub_explore: Overcurrent on port 2.
uhub_reattach_port: reattaching port 2
uhub_explore: Overcurrent on port 3.
uhub_reattach_port: reattaching port 3
uhub_reattach_port: Port 3 is in Host Mode
usb_needs_explore:
ugen0.3: <Prolific Technology Inc. USB-Serial Controller> at usbus0
uhub_explore: Overcurrent on port 4.
uhub_reattach_port: reattaching port 4
uhub_explore: Overcurrent on port 2.
uhub_reattach_port: reattaching port 2
uhub_explore: Overcurrent on port 3.
uhub_reattach_port: reattaching port 3
uhub_explore: Overcurrent on port 4.
uhub_reattach_port: reattaching port 4
uhub_explore: Overcurrent on port 5.
uhub_reattach_port: reattaching port 5
usb_bus_powerd: bus=0xffff000091fcb428
usb_needs_explore:
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
uplcom0 on uhub1
uplcom0: <Prolific Technology Inc. USB-Serial Controller, class 0/0, rev
2.00/3.00, addr 2> on usbus0
usb_bus_powerd: bus=0xffff000091fcb428
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power
usb_needs_explore:
usb_bus_powerd: bus=0xffff000091fcb428
usb_bus_powerd: Recomputing power masks
usbd_transfer_power_ref: Adding type 0 to power state
usbd_transfer_power_ref: needs power

Thanks,
Archimedes