USB-PD Charging Development

I figured we have multiple people working on the PD charging issues. At least @nanocodebug and me are independently looking at it.

Since I now have an account in the MNT gitlab, I pushed my current sources there: pocket-reform-sysctl-fw/sysctl.c · zeha-usbpd · Chris Hofstaedtler / Pocket Reform · GitLab

I believe the state management for Sink mode in my code is now “not completely wrong”, but it certainly has a lot of TODOs, and the USB-PD prescribed timers are all wrong.

I also know of an issue with at least one charger, where it appears in the FUSB RX FIFO a Source_Cap message with no objects appears. But my USB-PD tracer hardware does not see that message! I guess that means its either a problem with the FIFO being ran over or reading the message is broken somehow.

Mostly posting this so interested, and hopefully PD-knowledgable people, can take a look, and maybe we avoid work duplication.

4 Likes

A general observation: from the FUSB datasheet alone it is impossible to know what the host/device/drp software should actually do.
With the USB-PD spec at hand one can at least guess.

A lot of the USB-PD advice on the Internet also seems to be wrong and/or “too simple”. The popular hackaday articles assume a lot without really saying so - DRP is certainly not in scope there… :frowning:

3 Likes

PD trace from my current fw build with a random Apple 20W charger. IMO this looks a lot better than what we had before. Very happy so far.

2 Likes

An empty source message is strange, I’m glad to hear you have the interrupts working, I’ll have to try it against a few of my devices.

I have my attempt at an implementation and refactor in PR at the moment. Its automatic toggle between the two states instead of interrupts.

5 Likes

I downloaded and flashed the latest sysctl firmware from the main branch from source.mnt.re today, which I believe has this update.

I am happy to say my pocket now starts charging while powered up with different USB-C bricks, including the one shipped with the pocket from crowdsuppy :slight_smile:

Thank you!!!

4 Likes

All the thanks need to go to @nanocodebug! :slight_smile:

My changes are not in any released version yet.