I've been working a lot on this project lately. Unfortunately no pretty pictures to show, since I've been working entirely in software. I got started learning the PIC environment since this is my first time working with this controller. I picked up this MPLAB Xpress DM164140 evaluation board to get familiar with using the different PIC peripherals. For any of you wanting to get started with PIC, I highly recommend picking up this board. It cost me $12 and it has everything I've needed so far: 4 LEDs, a pushbutton, an i2c temperature sensor, uart through USB, ect. I was able to get interrupts working, as well as write my WS2813 driver, and now my i2c driver (after some difficulty).
Now that i2c is up and running, I spent a huge amount of time writing an interface to flash the STUSB4500 non-volatile memory on my USB C board. In other words, the STUSB4500 can be programmed with 3 power profiles, but if the battery is dead (and thus the microcontroller that programs the STUSB4500 is turned off), the power profiles will be the defaults stored in its non-volatile memory. This is bad because one of the default power profiles negotiates 20V, so if someone were to plug in a 20V charger while the battery was dead, 20V would be negotiated and my PMS would be fried. I've refactored and improved the crappy code ST provided to reprogram the default values in the STUSB4500. This interface is simple to use: you just edit the constants at the top of the file with the parameters that you want, and run the code to flash the chip. I flashed my chip today and with no battery connected I plugged in my 20V laptop charger, which was successfully negotiated to 15V.
The next step is to work on on-the-fly power profile programming. This means when a USB C charger is plugged in the STUSB4500 will read the capabilities of that charger, which the PMS microcontroller can then read, then program the STUSB4500 to use the highest safe power profile the charging source can supply. This eliminates only being able to have 2 custom voltage levels for negotiating, and also ensures the system is using the charger to its fullest capabilities. By the way, I will open source both the NVM flashing code as well as the on-the-fly power profile programming when it is completed so that everyone can get in on the USB C fun.
Last order of business, my revised version of the 3rd PCB I had delivered will arrive in around 2 weeks. I think you guys will like it. Stay tuned!