USB PD On CH32V003 Teaches You Everything

A devboard with the CH32V003, with a few resistors and bodges, with a USB-C cable plugged into it, and a programmer plus an extra probe attached.

How do you talk USB Power Delivery (PD)? Grab a PHY? Use a MCU with one built-in? Well, if you’re hardcore enough, you can do it with just a few resistors and GPIOs. [eeucalyptus] shows you their implementation of USB-PD on a CH32V003, which has no PD peripheral. This includes building a PD trigger, completely open source, and walking you through the entire low-level PD basics, too!

It helps that CH32V003 is a 32-bit MCU with a good few resources and peripherals, for instance, an internal comparator. Other than that, you don’t need much in terms of hardware resources, but you do need a steady hand — parts of the firmware had to be written in assembly to keep up with PD timing. Want to tinker with the fruit of this research, perhaps, further build upon the code? There’s an example board on GitHub, too!

Want to try your own luck with this method? There’s a schematic, and logic analyzer captures, and a board to refer to. Again, more than enough information on every single low-level detail! Otherwise, grab an MCU pre-programmed to talk PD, maybe a trigger board chip, or maybe even a PD PHY and implement PD communications with it directly – it’s pretty easy!

We thank [Julianna] for sharing this with us!

5 thoughts on “USB PD On CH32V003 Teaches You Everything

    1. I was glad to see you accounted for the variance in the RC oscillator but I’m also concerned about the variance in the resistors with regard to temperature. Most notably, the circuit could be heated unevenly causing the voltage divider to skew outside of acceptable margins. I haven’t looked at the full schematic but please be sure to double check the math on acceptable resistor tolerances and put them in the schematic.

      1. Interesting, so far I found that the signal level is one of the more robust electrical parameters. Table 5.15 in the v3.2 spec shows a Tx-level of 1.04 V to 1.2 V, so that’s quite a margin. But I get the uneven heat thing, on the test board I have an LDO on VBUS, that one might get quite warm :D

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.