From nobody Mon Apr 11 09:10:02 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 933011A902ED for ; Mon, 11 Apr 2022 09:10:13 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KcNNh1NMnz3jtD for ; Mon, 11 Apr 2022 09:10:12 +0000 (UTC) (envelope-from hps@selasky.org) Received: from [10.36.2.165] (unknown [176.74.213.87]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9BCEF2604AB; Mon, 11 Apr 2022 11:10:02 +0200 (CEST) Message-ID: <5deaf68b-267c-56dd-603d-8ec0d82ceae2@selasky.org> Date: Mon, 11 Apr 2022 11:10:02 +0200 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: Raspberry Pi 3B Over-current USB Content-Language: en-US To: Archimedes Gaviola , freebsd-arm@freebsd.org References: From: Hans Petter Selasky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4KcNNh1NMnz3jtD X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.29 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-0.99)[-0.993]; MLMMJ_DEST(0.00)[freebsd-arm]; FREEMAIL_TO(0.00)[gmail.com,freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/32, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N 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: 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: 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: 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: at usbus0, > cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) > bLength = 0x0012 > bDescriptorType = 0x0001 > bcdUSB = 0x0200 > bDeviceClass = 0x0000 > bDeviceSubClass = 0x0000 > bDeviceProtocol = 0x0000 > bMaxPacketSize0 = 0x0040 > idVendor = 0x067b > idProduct = 0x2303 > bcdDevice = 0x0300 > iManufacturer = 0x0001 > iProduct = 0x0002 > iSerialNumber = 0x0000 > bNumConfigurations = 0x0001 > > Configuration index 0 > > bLength = 0x0009 > bDescriptorType = 0x0002 > wTotalLength = 0x0027 > bNumInterfaces = 0x0001 > bConfigurationValue = 0x0001 > iConfiguration = 0x0000 > bmAttributes = 0x00a0 > bMaxPower = 0x0032 > > Interface 0 > bLength = 0x0009 > bDescriptorType = 0x0004 > bInterfaceNumber = 0x0000 > bAlternateSetting = 0x0000 > bNumEndpoints = 0x0003 > bInterfaceClass = 0x00ff > bInterfaceSubClass = 0x0000 > bInterfaceProtocol = 0x0000 > iInterface = 0x0000 > > Endpoint 0 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0081 > bmAttributes = 0x0003 > wMaxPacketSize = 0x000a > bInterval = 0x0001 > bRefresh = 0x0000 > bSynchAddress = 0x0000 > > Endpoint 1 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0002 > bmAttributes = 0x0002 > wMaxPacketSize = 0x0040 > bInterval = 0x0000 > bRefresh = 0x0000 > bSynchAddress = 0x0000 > > Endpoint 2 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0083 > bmAttributes = 0x0002 > 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