raspberrypi / rpi-eeprom

Installation scripts and binaries for the Raspberry Pi 4 and Raspberry Pi 5 bootloader EEPROMs
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-boot-eeprom
Other
1.28k stars 205 forks source link

Raspberry Pi 5 PMIC does not negotiate 5A current via USB-PD PPS profile #497

Open l3iggs opened 1 year ago

l3iggs commented 1 year ago

Describe the bug

The raspberry Pi 5 PMIC does not make use of 5000 mA current offered by a charger via USB-PD PPS profile. Instead, it gets stuck at 3000mA even when a charger that advertises a PPS PDO of 3.3V - 20V @ 5A (even when a 5A e-marked cable is used).

Steps to reproduce the behaviour

1) Buy a decent 3rd party USB type-c charger. For example, Anker 150W 747 Gan Prime. This charger happens to advertise the following PDOs [1]: image 2) Power a rpi 5 with it using a properly e-marked 5A cable. 3) Inspect the bootloader's power: line. It will show the power source as being only 3000 mA capable

As you can see in the image above, the charger offers a PPS PDO profile of 3.3 - 11V at 5A. 5V @ 5A falls squarely in that range and the pi5 should make use of this.

[1]: https://www.chargerlab.com/teardown-of-anker-150w-ganprime-747-charger-a2340/

Device (s)

Other

Bootloader configuration.

versions 30de0ba5 2023/10/30 and earlier

System

No response

Bootloader logs

No response

USB boot

No response

NVMe boot

No response

Network (TFTP boot)

No response

timg236 commented 1 year ago

This is expected. PPS is not supported.

timg236 commented 1 year ago

It would require considerable work in the firmware so for the foreeable future NGTF

greyltc commented 1 year ago

So you're saying there's a chance! (at some point) :-)

timg236 commented 1 year ago

So you're saying there's a chance! (at some point) :-)

Maybe ... not an expert on PPS, IIRC there are some hardware constraints plus more time-critical messaging to and from the power supply which will cause an unexplained reset (go to 'safe' 0V) if messaging goes wrong which is a disaster if the sink doesn't have a battery.

greyltc commented 1 year ago

oof yeah. too bad the safe fallback wasn't something like 5V@3A

greyltc commented 1 year ago

@timg236 I've got a Satechi model ST-TC100GM charger which has a 5V fixed 3A PDO and a PPS 3.3-20V @ 5A one. When the time comes, I'd be willing to help in testing out any pre-alpha firmwares you might have for this feature. I can recover from bad power up negotiations with a benchtop power supply.

timg236 commented 1 year ago

@greyltc I've re-opened this as a feature request so that anyone interested can track it. Warning, it's probably 50:50 whether this is actually doable :)

timg236 commented 1 year ago

Removed off-topic comments about product recomendations

TudbuT commented 8 months ago

Just to add my own 2 cents to this:

I've been observing a lot of voltage-related throttling on all of my non-official power supplies, so I checked with a lab bench PSU and it actually never exceeds 2A of current draw without anything plugged into the USB ports - it shouldn't be receiving too low a voltage. But it is, because of cable resistance. My cables are all unmarked and one of them is long but of good quality, and the rest are shorter but of dubious quality, so it's no wonder they're all pretty high resistance.

Indeed, I also have another 3A power supply that has a built-in high quality cable, and it gives me absolutely no issues. The power supplies therefore aren't even the main issue when it comes to throttling (that is, unless you have a bunch of stuff on your USB ports) - the cables are. (And they really are a big one: I'm seeing things like 4.5V despite the PSU still being at 5.)

Using PPS, the pi could ask for 5.1 or 5.2 volts, which would make the voltage drop on the cable less of a problem. It could even regulate the voltage dynamically depending on load, though I'm not sure how realistic that part would be. Some power supplies with fixed cables might even do this on their own, but I have no idea if that's actually the case.

greyltc commented 8 months ago

Using PPS, the pi could ask for 5.1 or 5.2 volts

The official 27W brick runs at 5.1V and has a permanently attached cable, I'm sure those design choices are for mitigating the voltage drop over the cabling. 5A is a lot. Using PPS to request a flat 5.2V no matter what seems like it would be a good idea to me. It's too bad the USB(/PD) spec didn't include some sort of provision for proper remote voltage sensing so that the source voltage supply could automatically and universally compensate for the voltage drop in the cables.

TudbuT commented 8 months ago

The official brick having a fixed cable is definitely deliberate. The majority of cables just kinda suck it seems, and permanently attaching a good one just avoids that problem for good. And it would also allow the PSU to compensate for the resistance since it's a known cable - but once again, not sure if that's actually done.

I have also finally found a high quality cable somewhere in my stash. It came with a USB-C laptop charger and needs to carry 100W (@20V/5A), so they gave it a lower resistance. It works just fine with this and basically any PSU, which basically confirms my hypothesis that the cables are the problem.

PPS 5.2V or higher would probably be able to at least lessen the issue. Not sure what the max voltage of the pi is, but 5.2V certainly works just fine according to my tests. (Okay, I checked with a search engine and it SEEMS 5.25V is the rated maximum, so I probably wouldn't go above 5.2)

actraiser30 commented 2 months ago

That's why everytime I use a flash drive the os freezes?

lurch commented 2 months ago

@actraiser30 For help with troubleshooting flash drives, you should ask for help on the forums, rather than on GitHub.

fanoush commented 1 month ago

it gets stuck at 3000mA even when a charger that advertises a PPS PDO of 3.3V - 20V @ 5A (even when a 5A e-marked cable is used).

just wondering what that means exactly. if it can otherwise do 5V/5A via PPS will it really limit the current if the device draws more than 3A at negotiated 5V mode? For pi5 the limit can be overriden in config.txt via usb_max_current_enable=1

timg236 commented 1 month ago

The feature request for USD-PD PPS is noted. Locking the issue to comments because the forums are a more appropriate place to have tech support discussions about USB-PD. Implementing PPS on the Pi5 PMIC doesn't appear to be very workable but if anything changes we can re-open this Issue so anyone can watch this Issue to get notified if something changes.