Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for analog USBPD on STM32G4xx. #11824

Merged
merged 2 commits into from
Feb 14, 2021

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented Feb 8, 2021

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
image
image

https://www.st.com/resource/en/reference_manual/dm00355726-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
image
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 to GND through the internal Rd when using the USBPD peripheral, so a reading of vRa=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

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@tzarc tzarc requested a review from a team February 8, 2021 05:27
@github-actions github-actions bot added the core label Feb 8, 2021
@tzarc tzarc force-pushed the stm32g4_analog_usbpd branch from 58be085 to d77064c Compare February 8, 2021 06:10
@tzarc tzarc force-pushed the stm32g4_analog_usbpd branch from d77064c to bd07d18 Compare February 8, 2021 06:11
@tzarc tzarc merged commit f53e41a into qmk:develop Feb 14, 2021
@tzarc tzarc deleted the stm32g4_analog_usbpd branch February 14, 2021 21:56
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* Add support for analog USBPD on STM32G4xx.

* Split up to a list of driver types, allow for custom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants