Close
0%
0%

PicoPD - USB-C PD 3.0 PPS Trigger with RP2040

Adding Power Delivery 3.0 (PD3.0) & PPS to our beloved RP2040 chip in Pico footprint.

Similar projects worth following
Why can't we just utilize laying around USB-C wall plugs to prototype higher voltage devices?
How about unlocking 5A at 5V on your PD3.1 charger?

PicoPD will help you negotiate the voltage from your USB PD wall plug/power bank while still retaining the full functionality of RP2040. It will be a good candidate to USB-C PD your motor control board, controllable power supply, LED driver, custom battery charger, and more!

Also, just an AP33772 evaluation board


Code: AP33772 - GitHub

Example Project: Variable power supply with USB-C PPS - PicoPD

Specification:

  • Power
    • Capable of USB PD3.0 PPS provides 4V-21V output in 20mV step
    • Capable of USB PD2.0 Fixed Power of 5, 9, 12, 15, or 20 V at a maximum of 5A (100 W at 20 V)
    • +20A capable P-MOS load switch tied to USB-C VBUS
    • USB Type-C port (for power delivery and programming)
    • USB-C current read +/- 50mA
    • ESD protection on D+/D-/CC1/CC2 pins
    • V1.2: 200mA LDO AP2204K-3.3 Low dropout
      • V1.0/V1.1:TPS62933 for efficient DC-DC converter for 3.3V @ 3A output
  • Microcontroller
    • RP2040 flexible clock running up to 133 MHz
    • 264kB on-chip SRAM
    • 16MB on-board QSPI flash
  • I/O
    • 2x VBUS pin output (4V to 21V)
    • 2x 3V3 pin output (up to 3A)
    • 3x 12-bit analog inputs
    • 26 multifunction GPIO pins
    • USB 2.0 breakout header
  • LEDs
    • Red - Power indicator
    • Green - User controllable - GPIO 25
  • Reset button
  • Boot button
  • Programming: Through USB-C, USB header, or SWD

Changing voltage on the fly

Key player

The key player that enables the PD ability is the AP33772 IC from Diodes Incorporated. This is a relatively new IC that has an integrated USB PD controller with PPS capability. Power selection and power rail status checks can be done over I2C. All of the PD negotiation, refresh, and timing are done by the AP33772 IC. The microcontroller after making its power request in Setup(), is free to perform another task. This also simplified the code in comparison to the good old FUS302B which requires the microcontroller to do the heavy lifting.

The typical circuit utilizes a back-to-back NMOS configuration to create a bidirectional power switch. The switch remains open until the PD power negotiation is complete. My design omitted the NMOS switch so that the RP2040 can be powered as soon as the USB-C is plugged in.

Auto-detection for E-Mark (5A) and non-E-Mark (3A) cables using the same power supply.

Circuit

As we are designing a built-in USB PD/PPS pico board, we need all of the basic parts that make it a Pico.

  • RP2040 IC
  • Crystal Oscillator 12MHz
  • SPI flash
  • Supporting capacitors and resistors

But since we are going to have USB-C and higher power input than just 5V, we need higher voltage rating components and specialized IC:

  • USB-C PD controller: AP33772 IC
  • USB-C Receptacle 16 pins (USB 2.0 speed) 5A VBUS rated
  • ESD diode for CC1, CC2,D- and D+
  • 4V-30V DC-DC buck converter for 3.3V power rail
  • P channel MOSFET as a load switch

The RP2040 has 2x I2C hardware blocks I2C0 and I2C1. The USB-C PD controller will be connected to the I2C0 block at GPIO0 and GPIO1. Check the pinout for more details.


Testing Outcome

PicoPD V1.2.step

3D model for PicoPD V1.2

step - 16.83 MB - 12/07/2023 at 08:44

Download

Schematic V1.2.pdf

Schematic for PicoPD V1.2

Adobe Portable Document Format - 210.27 kB - 12/07/2023 at 08:42

Preview
Download

Bill Of Material.csv

Bill of material with JLCPCB parts

Comma-Separated Values - 1.05 kB - 09/28/2023 at 06:54

Download

PicoPD Gerber V1.1.zip

Gerber files for PicoPD V1.1

x-zip-compressed - 166.44 kB - 09/28/2023 at 06:40

Download

PicoPD Gerber.zip

Gerber files for PicoPD V1.0

x-zip-compressed - 164.97 kB - 09/03/2023 at 18:16

Download

  • Improve 3.3V Rail with V1.2 + AP33772 Lib Completed

    CentyVin11/30/2023 at 06:20 0 comments

    Changes with V1.2 PicoPD:

    • Replace buck TPS62933 with LDO AP2204K-3.3. This will drop the total output current from 3A to 200mA. However, we get a much cleaner and more accurate 3V3 line to 0.5% (DeltaVout/Vout). Our internal ADC will happily accept this stable voltage. Lower dropout voltage means requesting PPS as low as 3.5V before messing up your ADC read scaling. Fortunately, the LDO output will still be stable, just less than 3.3V if the input is below 3.5V. The previous buck converter design will be unstable when the input voltage drops below 4V, causing the system to reset.
    • Reduce component count.

    Update on AP33772 library:

    • Multiple users have tested the library and it seems to be stable.
    • The latest release has included setMask and clearMask functions

  • Refine PCB layout with V1.1

    CentyVin09/28/2023 at 06:53 0 comments

    Learning from the previous design, I have made some changes to the layout while keeping the schematic the same. Here are some main changes:

    • Highlight 0-ohm jumper resistor: To use the USB 2.0 header, remove these 2 jumpers. 
    • Highlight GND ports on the top layer
    • Thermal relief for the USB header: Easier to solder and desolder

    The next October 25th,2023 batch will be V1.1. You can make your own using the provided Gerber, else you can support me through Tindie PicoPD.


  • AP33772 Library Release

    CentyVin09/03/2023 at 08:59 0 comments

    I think the library is now at a point where you can use it for most of your applications. As of right now, it feature:

    • Fix voltage and PPS voltage request
    • Voltage reading
    • Current reading
    • NTC temperature reading
    • Set parameter for NTC

    Examples are included to cover most of the use cases that I can think of. Feel free to create an issue or comment here if you have any questions about your specific need.

    Still missing the ability to edit Mask which will be updated soon. The library also does not support interrupt mode so there will be no self-feedback from the IC. I look forward to further testing.

    GitHub - AP33772-Cpp

    Tested with:

  • AP33772 Library in progress

    CentyVin09/02/2023 at 00:32 0 comments

    I have been working on the AP33772 library. As of right now, I have most of the basic functionality satisfied like:

    • Set voltage
    • Set max current
    • Set warning/safety value
    • Read voltage
    • Read current

    With 140W Ugreen GaN charger - PPS

    With BaseUS GaN2 Pro - PPS

    With RavPower PD Pioneer 90W - Non-PPS

  • Second iteration - 1st batch order

    CentyVin08/30/2023 at 07:31 0 comments

    The 2nd iteration covers all the mistakes made in the previous one:

    •  5.1k Ohm termination on CC1 and CC2 to GND
    • QuadSPI flash
    • Crystal oscillator with 50Ohm ESR 
    • 1K series resistor to limit crystal oscillator drive
    • USB trace set to 90Ohm differential impedance

    Additional upgrade:

    • Breakout USB header to have extra D+/D- and 5V input
    • Blocking diode between 5V input and VBUS
    • Easier to press buttons


    Design challenges

    The initial design has USB D+/D- connected only to the USB-C. If using the USB-C only, the user has two options,

    • Connect to PC: programming and serial debugging, no USB PD.
    • Connect to USB brick: running existing code without the ability to flash or serial debug the code.

    All of this can be solved if you have an external flasher and debugger tool like Pico Probe using the SWD pins. Pico Probe works well with PlatformIO to compile and flash C++ code, but for MicroPython code using Throny, check out this method of packing your files into .uf2 and flash using PicoProbe. It is not as easy as just plug in your USB cable and flash it!

    What if we add extra header pins for the USB cable and a switch to select where the D+/D- comes from?

    The RP2040 has USB 2.0 hardware that is running at full speed. This means the fastest driver rise time is 4ns. FR4 propagation time is 6 inches/ns. We have a signal propagation distance of 24 inches over the 4ns rise time. If we are conservative and take 10% of the critical length, we have 2.4 inches of critical length that we can lose on impedance control. -> We have no problem losing impedance control over one 0 Ohm jumper 0402 resistor and one via.

    Now when adding the extra header, if not connected, we have a permanent trace stud on the D+/D- line. This stub can impact the signal by creating a reflection when the signal travels to the end of the stud and bounces back. Following this rule of thumb to calculate the max length of the stud and USB 2.0 Fullspeed @ 12Mbps, we have:

    maxStudLength (cm) = 0.75 / BitRate(Gbps) = 0.75 / 0.012(Gbps) = 62cm.

    62cm seems to be too long! However, if that is the case, we can have a permanent header sticking out at 1.4cm + (0.5cm for traces) without much of a reflection problem.

  • First iteration - 1st batch order

    CentyVin08/30/2023 at 06:55 0 comments

    Once the first batch of the first design arrived. I was quite excited to plug it in and hope the red LED will turn on indicating that there is 5V power going into the buck converter. But nothing lights up. I also wasn't able to flash the board and run blink. A bit of debug shows that I have made some rookie mistakes:

    • No 5.1k Ohm termination on CC1 and CC2 to GND
    • Order DualSPI flash instead of QuadSPI flash
    • SPI flash decoupling capacitor is placed too far away from the IC
    • Crystal Oscillator has 80Ohm ESR instead of 50Ohm ESR recommended by Rasberry Foundation
    • No series resistor to limit crystal drive
    • USB trace is not set to 90Ohm differential impedance

    Another Hackaday member also raised the question of how can you debug the board while providing PD power. With the current design, there are only two methods:

    • Use a USB-C Splitter to have CC1 and CC2 routed between PicoPD and power brick, and have D+/D- routed between PC and PicoPD
    • Use PicoProbe to program via SWD, and just plug the power brick directly into PicoPD

    The AP33772 IC also can perform a "hard reset" which will cut off the power to the PicoPD temporarily. If "hard reset" is in the code, the device can stuck at a boot loop. To prevent this, a separate power supply is needed if the sole purpose is debugging. 

    ---> 2nd design iteration is coming

View all 6 project logs

Enjoy this project?

Share

Discussions

corhen wrote 11/14/2023 at 01:27 point

This is a really cool project, and pretty close to what i want.  Two questions:

1) How hard would it be to use a potentiometer to change the request voltage?
2) can this handle a full 3 amps at the voltages?

  Are you sure? yes | no

Nick Cook wrote 11/16/2023 at 14:19 point

1) Wiring is as easy as using a ADC Pin on the PicoPD and then changing the programming to scale the potentiometer to the pps range (0-20V) you could use two pots and do both voltage and current. i am working on this now but am waiting on a small 1.3" screen to show values as i need a small variable supply for field tests and i may use an encoder instead of a pot.

2) Being Fully PD3.0 Compliant the PicoPD can run upto  20V/5A (100W)

I will post my project once it is complete.

  Are you sure? yes | no

CentyVin wrote 11/19/2023 at 16:55 point

Hi Corhen. Please check out this example project https://hackaday.io/page/21022-variable-power-supply-with-usb-c-pps-picopd

  Are you sure? yes | no

jacobsson wrote 11/07/2023 at 10:54 point

I'd love to see this in format as those small PD decoy modules you can buy!
I wonder in theory how small this could get if was pre-programmed for a fixed voltage.

  Are you sure? yes | no

CentyVin wrote 11/07/2023 at 18:33 point

That is a good challenge. I might have to make them one sided to save cost. Are you thinking of decoy with PPS? Small but programable?

For non PPS, Adafruit just release a board that you can set voltage with solder bridge. But pps allow you to pull 5A at "any voltage"

  Are you sure? yes | no

jacobsson wrote 11/19/2023 at 22:38 point

Yes, PPS would be sick in that format, even if it's a set voltage. This would change everything when it comes to wall chargers and old/new electronics! 

  Are you sure? yes | no

CentyVin wrote 11/19/2023 at 16:53 point

Hi Jacobsson,

FYI, I am making a small trigger board that do exactly what you said. Aim to release in 3 weeks. I will create a project page soon

  Are you sure? yes | no

jacobsson wrote 11/19/2023 at 22:34 point

Please notify me when it's due! I love this ❤️

  Are you sure? yes | no

CentyVin wrote 4 days ago point

@jacobsson I just created a new project. I am a bit busy with work but the prototype is working. Please find the project here https://hackaday.io/project/193933-ppstrigger-board

  Are you sure? yes | no

Nick Cook wrote 10/23/2023 at 14:27 point

Sounds good! Thank you

  Are you sure? yes | no

Nick Cook wrote 10/23/2023 at 11:30 point

Is there a possibility of supporting PD3.1 in a future revision?

  Are you sure? yes | no

CentyVin wrote 10/23/2023 at 13:07 point

We do have PD3.1 (up to 48V) development in the pipe line. The silicon is a bit more difficult to source so we might have to gauge demand, and might even do a group buy.

  Are you sure? yes | no

Nick Cook wrote 11/16/2023 at 20:08 point

i came across this chip it supports 3.1 and does not need alot of external components. i might do some design work if i get the time. HUSB238A

https://www.hynetek.com/uploadfiles/site/219/news/24322c00-2276-4d74-98db-c74432318210.pdf

  Are you sure? yes | no

CentyVin wrote 4 days ago point

@Nick Cook Hi, you have stumbled on the same IC as us. Same problem, we all need free time from daily job :(

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates