Add support for analog USBPD on STM32G4xx. #11824
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds support for analog mode USBPD on STM32G4xx.
This does not include the full state machine implementation required to allow for anything higher than 5V/3A.
5.1k resistors are no longer required on designs, as long as the dead battery signals are connected to the CC pins on the MCU, and connected to the CC pins on the USB connector.
For board designers: it is highly suggested that ESD protection is also applied to the CC lines as well as the D+/D- lines.
For @qmk/collaborators: I've intentionally left out documentation as this is intimately tied to chip selection and board design. People unknowingly playing with this subsystem can eventually cause damage to PCB traces.
Supporting config screenshots:
https://www.st.com/content/ccc/resource/technical/document/technical_article/group0/59/a8/53/96/fe/a8/45/35/DM00496853/files/DM00496853.pdf/jcr:content/translations/en.DM00496853.pdf
https://www.st.com/resource/en/reference_manual/dm00355726-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
Note
Ra
is effectively the in-cable 5.1k pull-down, due to cheaper cables usually only including one CC line. On the sink side,Ra
is connected toGND
through the internalRd
when using the USBPD peripheral, so a reading ofvRa=0
should also signify base USB current capability. Some (most?) cheap cables seem to connect both CC lines to the same conductor in the cable, so the max is taken between both readings.Types of Changes
Checklist