ryan-ma / PD_Micro

USB-C PD3.0 PPS on ATMega32U4 Arduino board
MIT License
383 stars 69 forks source link

Current limit not being enforced in PPS mode #1

Closed nsluhrs closed 3 years ago

nsluhrs commented 3 years ago

Hello,

I was doing some testing with my shiny new PD Micro and it doesn't seem to be respecting the current limiting. I can pull 380mA despite setting the current limit to 200mA. Just as a sanity check here's the init line I'm using. Everything else is the same as the pps example file. PD_UFP.init_PPS(PPS_V(9.2), PPS_A(0.2)); The load is 25 Ohm at dc and 66mH (not that inductance should matter in this case.

I honestly kind of doubt this is a problem with the PD Micro, I suspect it may be an issue with the USB PSU I'm using, but any debugging advice would be nice.

Best, Nik

ryan-ma commented 3 years ago

Hi Nik,

The current limit in PPS is quite coarse. The PD spec only requires the PD power supplies to provide accuracy of 150mA when souring more than 1A, or +/-5% when souring more than 3A.

USB_PD_R3_0 V2.0 20190829.pdf - page 246 - 7.1.4.4 Programmable Power Supply Current Limit

......
The PPS Operating Current regulation accuracy during Current Limit is
defined as iPpsCLNew. The minimum programmable Current Limit level is iPpsCLMin.
......

USB_PD_R3_0 V2.0 20190829.pdf - page 309 - 7.4.1 Source Electrical Parameters

......
iPpsCLMin (Minimum Current Limit setting)
- Minimum: 1A
iPpsCLNew (Current Limit accuracy)
- 1A ≤ Operating Current ≤ 3A : +/-150mA
- Operating current > 3A : +/- 5%
......