raspberrypi / bookworm-feedback

14 stars 1 forks source link

Pi 5 dwc2 overlay fails #77

Closed thagrol closed 11 months ago

thagrol commented 1 year ago

Likely more of a Pi 5 issue than a strictly Bookworm issue but as the two go together...

Hardware: Pi 5 8GB, 16GB SD card OS: Raspberry Pi OS Bookworm full downloaded and updated today. Booting to command line w/o automatic login

Problem: enabling the dwc2 overlay and USB controller fails. The dwc2 kernel modules is loaded, g_* modules will load but the corresponding devices are not present on either RPiOS or the USB host.

Steps to reproduce:

  1. Download, install, and update OS.
  2. Add any one of the following to /boot/config.txt
    
    [all]
    dtoverlay=dwc2
[all]
dtoverlay=dwc2,dr_mode=host
[all]
dtoverlay=dwc2[,dr_mode=peripheral
3.    Reboot

**Other information:**
dmesg includes the following:

pi@pi5:~ $ dmesg|grep dwc [ 1.333392] dwc_otg: version 3.00a 10-AUG-2012 (platform bus) [ 1.339252] dwc_otg: FIQ enabled [ 1.339255] dwc_otg: NAK holdoff enabled [ 1.339257] dwc_otg: FIQ split-transaction FSM enabled [ 1.339261] Module dwc_common_port init [ 2.757311] dwc2 107c480000.usb: supply vusb_d not found, using dummy regulator [ 2.768661] dwc2 107c480000.usb: supply vusb_a not found, using dummy regulator [ 2.811867] dwc2 107c480000.usb: dwc2_core_reset: HANG! Soft Reset timeout GRSTCTL_CSFTRST [ 2.820521] dwc2: probe of 107c480000.usb failed with error -16


Attmpting to manually load the dtoverlay (_sudo dtoverlay dwc2_) results in

pi@pi5:~ $ sudo dtoverlay dwc2 DTOVERLAY[warn]: no matching platform found



Same SD card and cables work as expected with a 4B.

See also https://forums.raspberrypi.com/viewtopic.php?t=357757
pelwell commented 1 year ago

Thanks - we're aware of this problem. The Pi 5 bootloader/firmware is missing a small amount of initialisation code required to enable the DWC OTG USB interface.

lijoseph commented 1 year ago

noticed that there is a dwc2-pi5, for dtoverlay in config.txt should it be

dtoverlay=dwc2-pi5 ?

timg236 commented 1 year ago

dwc2 - the suffix is not required, although I don't think the firmware support is available yet

Reiss-Cashmore commented 1 year ago

Any movement on this issue? Really enjoyed the ipad pro direct USB over Ethernet VNC setup on the Pi 4. Don't see any workarounds to get that working for the 5

pelwell commented 1 year ago

It's coming - we're not exactly resting on our laurels here.

Reiss-Cashmore commented 1 year ago

Ooh I see this commit yesterday, https://github.com/raspberrypi/firmware/commit/ce3a0b4197eaf311ba0734efdb9f5bdedefe5e27 https://github.com/raspberrypi/firmware/commit/9272f0fd51914c2cacdef93c1b0eef190cacaadb

and a version bump here https://github.com/raspberrypi/firmware/commit/83dafbc92c0e63f76ca2ecdd42462d56489d1c77

Does that mean that Pi 5 dwc2 is available if I do a sudo rpi-update I can get v6.1.61 and this fix?

Thanks

6by9 commented 1 year ago

Ooh I see this commit yesterday, raspberrypi/firmware@ce3a0b4 raspberrypi/firmware@9272f0f

and a version bump here raspberrypi/firmware@83dafbc

Does that mean that Pi 5 dwc2 is available if I do a sudo rpi-update I can get v6.1.61 and this fix?

No, as pelwell says, it's coming. Those commits are steps on the road, but not there yet.

dh4nav commented 1 year ago

My apologies for asking, but is there at least an approximate time horizon when you expect this regression to be fixed? Right now we're in the process of procuring new Raspberry Pis for our remote learning setups (which use this function), and we're currently wondering if we need to procure 4Bs instead of 5s, or if we should wait a few more days. Again, my apologies for asking, I know you're doing your very best, but I hope you can give us an estimate (or a "we can't tell at all" if that is the case) to help us decide which path to go. Thank you very much.

acidtech commented 1 year ago

I assume the dwc2 problem also applies to using the USB-C connector in Host mode? I have a USB-C audio dac I want to use but can't get it to show up.

pelwell commented 1 year ago

Correct.

6by9 commented 12 months ago

Cause found.

https://github.com/raspberrypi/linux/pull/5772 fixes the kernel side, but there's a bootloader update required too.

acidtech commented 12 months ago

Thank you. Is there an estimated timeline when this will be in the main release?

Nathan Scherdin

On Wed, Dec 6, 2023 at 9:06 AM 6by9 @.***> wrote:

Cause found.

raspberrypi/linux#5772 https://github.com/raspberrypi/linux/pull/5772 fixes the kernel side, but there's a bootloader update required too.

— Reply to this email directly, view it on GitHub https://github.com/raspberrypi/bookworm-feedback/issues/77#issuecomment-1843306340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3QXKJYNX4EZDWFL2I6L5TYICQYXAVCNFSM6AAAAAA6BADSZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGMYDMMZUGA . You are receiving this because you commented.Message ID: @.***>

dh4nav commented 12 months ago

Cause found.

raspberrypi/linux#5772 fixes the kernel side, but there's a bootloader update required too.

Thank you very much for working on this.

Is there any way I can help with the Bootloader side? I'd be happy to donate my time for this. (I know C/C++ [and Python and FORTRAN, but I suspect those won't be that helpful here])

lurch commented 12 months ago

I think the bootloader-update part of this is in https://github.com/raspberrypi/rpi-eeprom/pull/503

dh4nav commented 12 months ago

I think the bootloader-update part of this is in raspberrypi/rpi-eeprom#503

Ah cool, thank you for the info!

nickovs commented 11 months ago

I see that the EEPROM part of this got pushed out as an update yesterday. Could someone from RPi comment on when the kernel side might make it out into the field?

pelwell commented 11 months ago

That depends on how large a field you want. It's available now as a beta via sudo rpi-update. Updates to the stable branch (and thence to the regular raspberrypi-kernel package) are less frequent, but can be accelerated if an important feature or bug fix is required.

nickovs commented 11 months ago

@pelwell Thanks for the reply. I have tried with the 6.1.66-v8-16k+ (Mon Dec 11 12:10:50 GMT 2023 ) kernel installed by rpi-update but I can't get any host computer to recognise the presence of the Pi5, either as a serial gadget or as an ethernet gadget. Would you expect it to be working with that kernel?

pelwell commented 11 months ago

I've not tried it in either mode myself, but I expected that with the fixed DTB and the appropriate config.txt and cmdlline.txt settings that both host mode and gadget mode would work.

What configuration changes have you made? Is this something you've had working on an older Pi?

hardillb commented 11 months ago

This is all working with ecm and rndis ethernet devices.

Thanks for getting this working again, I'll update my scripts for modifying RaspberryPiOS images over Christmas.

gwoweiming commented 11 months ago

Hello, has this problem been fixed?

pelwell commented 11 months ago

We believe so, provided the EEPROM image is also updated.

olsonmn commented 11 months ago

Issue does not appear to be resolved.

Updated the EEPROM on a Raspberry Pi 5. The USB network device is now created on the Pi 5, which did not occur before the EEPROM update.

All looks fine from the Pi 5; USB device is created, is recognized in Network Manager, and can create a shared connection.

But the client hardware on the other end of the USB cable does not detect a USB Ethernet device. Same thing observed with both a Linux and Mac device.

Move the MicroSD card to a Pi 4, and it works perfectly.

Fully updated Raspbian OS. Managing with network manager.

Entry in cmdline.txt is "modules-load=dwc2,g_ether" Entry in config.txt is "dtoverlay=dwc2" /etc/modules contains "libcomposite" and "g_ether"

hardillb commented 11 months ago

@olsonmn I have this working, but I had to remove the serial port I was also creating. You can find my script for setting up the devices here: https://www.hardill.me.uk/wordpress/2023/12/23/pi5-usb-c-gadget/

You should not need the g_ether

olsonmn commented 11 months ago

@olsonmn I have this working, but I had to remove the serial port I was also creating. You can find my script for setting up the devices here: https://www.hardill.me.uk/wordpress/2023/12/23/pi5-usb-c-gadget/

You should not need the g_ether

Thank you for the quick response; it is now working.

Applying the "sudo rpi-update" from your blog post fixed the problem. I had run "sudo rpi-eeprom-update -a", so my guess is the latest EEPROM updates have not yet made it through to the public repositories.

cowrevenge commented 11 months ago

Just received my new Pi5 and can confirm stock issues, the applied fix/update is working with my pi 4 scripts now. Thanks so much, i was worried this would get ignored.

rodrigocmn commented 11 months ago

I was able to make it work on non Apple devices, but it didn't work on either my iPad or MacBook. The only way I've managed to connect to my apple devices was through USB-A to USB-C (I had to use an adapter for that). Anyone managed to connect to Apple devices using USB-C to USB-C?

olsonmn commented 11 months ago

I did get it to work USB C to USB C on a Macbook Air, but it does not appear to work 100% of the time.

pelwell commented 11 months ago

I've found my Macbook Pro has a very limited ability to power devices over USB C (which is all it has).

olsonmn commented 11 months ago

I suspect his is the root of many of the "USB C to USB C" issues. It is not the USB A that solves the problem, it is the powered hub in the middle that is solving the problem.

acidtech commented 11 months ago

Just confirming the "sudo rpi-update" fixed the USB C audio detection and function. Thank you.

Nathan Scherdin

On Wed, Jan 3, 2024 at 8:56 AM olsonmn @.***> wrote:

I suspect his is the root of many of the "USB C to USB C" issues. It is not the USB A that solves the problem, it is the powered hub in the middle that is solving the problem.

— Reply to this email directly, view it on GitHub https://github.com/raspberrypi/bookworm-feedback/issues/77#issuecomment-1875678436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3QXKOEXDMHDFH2BFZP7YTYMWEUPAVCNFSM6AAAAAA6BADSZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGY3TQNBTGY . You are receiving this because you commented.Message ID: @.***>

rodrigocmn commented 11 months ago

I suspect his is the root of many of the "USB C to USB C" issues. It is not the USB A that solves the problem, it is the powered hub in the middle that is solving the problem.

I'm not using a powered hub between my iPad and Pi5, just a USB-C to many USB-A ports adapter. Also, my Macbook is the 14 inch Apple M1 Pro version with Thunderbolt 4 (USB-C) ports. I would expect it to have enough power to support a RPi.

pelwell commented 11 months ago

From a MacRumors answer (https://forums.macrumors.com/threads/usb-power-output-of-m1-and-m2-macbook-usb-c-thunderbolt-ports.2356508/):

Minimum power output for the first port is 15W, and 7.5W for subsequent ports, per thunderbolt/USB4 specification.

So if you have nothing else plugged in you might get 3A @ 5V (marginal on a Pi 5), otherwise it could be 1.5A (nope).

ihew commented 11 months ago

Just confirming the "sudo rpi-update" fixed the USB C audio detection and function. Thank you. Nathan Scherdin

May I ask from which build/OS to initiate the command? Just to have a reliable method...

rodrigocmn commented 11 months ago

From a MacRumors answer (https://forums.macrumors.com/threads/usb-power-output-of-m1-and-m2-macbook-usb-c-thunderbolt-ports.2356508/):

Minimum power output for the first port is 15W, and 7.5W for subsequent ports, per thunderbolt/USB4 specification.

So if you have nothing else plugged in you might get 3A @ 5V (marginal on a Pi 5), otherwise it could be 1.5A (nope).

Ok... just to rule out the power problem, I'm using an unpowered usb hub with both iPad and Macbook Pro. That's why I can't understand why it works with a USB-C hub connecting via its USB-A port to RPi's USB-C port, and the direct USB-C to USB-C doesn't work. I can even ssh to the RPi5 via Wi-Fi in both scenarios.

ihew commented 11 months ago

From a MacRumors answer (https://forums.macrumors.com/threads/usb-power-output-of-m1-and-m2-macbook-usb-c-thunderbolt-ports.2356508/):

Minimum power output for the first port is 15W, and 7.5W for subsequent ports, per thunderbolt/USB4 specification.

So if you have nothing else plugged in you might get 3A @ 5V (marginal on a Pi 5), otherwise it could be 1.5A (nope).

Ok... just to rule out the power problem, I'm using an unpowered usb hub with both iPad and Macbook Pro. That's why I can't understand why it works with a USB-C hub connecting via its USB-A port to RPi's USB-C port, and the direct USB-C to USB-C doesn't work. I can even ssh to the RPi5 via Wi-Fi in both scenarios.

Hm. Something like in

https://forums.raspberrypi.com/viewtopic.php?t=246348

where in the hub setup the roles would be clear?

acidtech commented 11 months ago

I literally downloaded the latest release image, burned the SD card, booted up the Pi, opened a command line and ran sudo rpi-update. After that I believe I had to reboot. I already had enabled the USB-C host in config.txt and the USB-C audio dac came right up.

Nathan Scherdin

On Wed, Jan 3, 2024 at 11:33 AM ihew @.***> wrote:

Just confirming the "sudo rpi-update" fixed the USB C audio detection and function. Thank you. Nathan Scherdin

May I ask from which build/OS to initiate the command? Just to have a reliable method...

— Reply to this email directly, view it on GitHub https://github.com/raspberrypi/bookworm-feedback/issues/77#issuecomment-1875865829, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3QXKIHG5FTR4LYS2NHOJ3YMWW7JAVCNFSM6AAAAAA6BADSZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVHA3DKOBSHE . You are receiving this because you commented.Message ID: @.***>

rodrigocmn commented 11 months ago

I’ve just updated the RPi5’s firmware this morning and USB-C to C worked with my MacBook, but stopped working after reboot. My naive guess is that something was reset during the upgrade, but changed during the reboot. I even tried to force an update (delting .bootloader_revision and .firmware_revision files), but din’t work anymore.

pelwell commented 11 months ago

It's possible that cold boot and reboot work differently. And beware the danger of looking for patterns in essentially random data.

cowrevenge commented 11 months ago

I can also confirm that update worked only for a short time. The device is no longer showing up properly after full power down.

I have tried forcing full USB power and power is a 65W adapter.

Not solved. Just going to return this pi and return to the pi 4. Pi5 also has issues with the CSI-2 adapter duo to lacking hardware encoding. I will try again after the tech is more developed.

acidtech commented 10 months ago

Just adding information. I ONLY tested a USB audio device. I am pretty sure I rebooted/power cycled after installation but I will have to double check now. :)

Nathan Scherdin

On Sun, Jan 7, 2024 at 4:58 AM cowrevenge @.***> wrote:

I can also confirm that update worked only for a short time. The device is no longer showing up properly after full power down.

Not solved.

— Reply to this email directly, view it on GitHub https://github.com/raspberrypi/bookworm-feedback/issues/77#issuecomment-1880053132, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3QXKKOUAAVVIG3O37G4VLYNKLXTAVCNFSM6AAAAAA6BADSZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGA2TGMJTGI . You are receiving this because you commented.Message ID: @.***>

argusro commented 10 months ago

Hello, just to share, I managed to get the keyboard and mouse to work over OTG using PiOS 32-bit, but not 64-bit. I have a notebook-like dock from Nexdock, that uses a USB-C to provide power and share keyboard & mouse, with the video going by HDMI. All I had to do was burn the OS on the SD, do the usual updates and upgrades, and add the following to the /boot/config.txt: dtoverlay=dwc2,dr_mode=host,g_hid Btw, the dock also has a USB port and micro SD card slot, both are working as well.

First I was trying the 64bits PiOS, but on dmesg I was getting the following error: device descriptor read/64, error -32 Searching I found a StackExchange saying that this is an issue with OSs and some hardware/BIOS over 64-bit OS, so I tried 32-bit, and worked. Will try again in the future, but for now it's working fine, no issues after reboot.

Qwe123po commented 10 months ago

Issue does not appear to be resolved.

Updated the EEPROM on a Raspberry Pi 5. The USB network device is now created on the Pi 5, which did not occur before the EEPROM update.

All looks fine from the Pi 5; USB device is created, is recognized in Network Manager, and can create a shared connection.

But the client hardware on the other end of the USB cable does not detect a USB Ethernet device. Same thing observed with both a Linux and Mac device.

Move the MicroSD card to a Pi 4, and it works perfectly.

Fully updated Raspbian OS. Managing with network manager.

Entry in cmdline.txt is "modules-load=dwc2,g_ether" Entry in config.txt is "dtoverlay=dwc2" /etc/modules contains "libcomposite" and "g_ether"

how to do the last step

ihew commented 10 months ago

Can we have a short discussion (and maybe testing) what the correct dr_mode config.txt settings per gadget would be?

AFAIK, there are three modes for (forced) dr_mode : otg, host and peripheral. In gadget mode I would expect "peripheral" to be the one to use, to connect keyboards and othe HIDs I would expect it to be"otg" or "host".

I may be wrong, but since I have seen them used arbitrarily or not at all in this thread, it would be nice to see what the correct setting would be and if helps with any of the observed oddities.

Also found a discussion on a similar topic that mentions deprecation and cmdline.txt vs config.txt, so it might be worth a second look:

https://github.com/raspberrypi/rpi-imager/issues/358

pelwell commented 10 months ago

Gadget mode = peripheral Host controller = host

otg tells the driver to use the OTG pin to select between the two - it's safer to avoid this mode.

frawau commented 10 months ago

Just FYI. I can get the mass storage gadget to work on the RPi5 after an rpi-update, but only on 32bits OS. It does not work with 64bits OS.

I use dtoverlay=dwc2

And my app can "insert" and "remove" multiple virtual thumb drives, multiple times.

timg236 commented 10 months ago

USB mass storage gadget mode works on 64-bit operating systems e.g. here's a buildroot 64-bit mass-storage gadget.

https://github.com/raspberrypi/usbboot/tree/master/mass-storage-gadget64

I'm locking this bug because the issue reported issue is resolved and the forums are a more appropriate place for general topic discussions.