Skip to content
Manuel Bl edited this page Apr 25, 2023 · 1 revision

The STM32 F4 family includes popular MCUs like the STM32F401CC found on the popular Black Pill board.

Supported MCUs / Boards

  • STM32F401CC (used on Black Pill boards)

Required Additional Components

  • For both monitor and sink mode, an additional comparator is needed to level shift and combine the CC1 and CC2 signals.
  • For transmission in sink mode, multiple resistors are needed.

Pin Assignment

STM32 Pin Board Label Signal Monitor Sink Peripheral
PA1 A1 CC_3V3 X X Timer 2, channel 2, input capture EXTI interrupt
PA3 A3 CC1 X X ADC1, channel 1
PA2 A2 CC2 X X ADC1, channel 0
PA7 A7 CC1_TX X SPI1 MOSI
PA6 A6 CC1_TX_EN X GPIO output
PB5 B5 CC2_TX X SPI1 MOSI
PB4 B4 CC2_TX_EN X GPIO output
PB3 B3 DEBUG (X) (X) Optional. GPIO output for debugging

Exclusive Use of Peripherals

The below peripherals are used exclusively by this USB PD library. They cannot be used – directly, or indirectly – by other code without interfering with the library operation.

As the only ADC is used by the library, analogRead() is no longer available.

Furthermore, SPI1 is not available if the library is run in power sink mode. If SPI communication is needed, use another SPI peripheral and its associated pins.

Peripheral Monitor Sink Usage
TIM3 X X Timer for scheduling tasks
TIM2 X X Timer for CC1/CC2 input capture (channel 2) and triggering the ADC (channel 3)
EXTI pin 1 X X External interrupt
DMA1 stream 6 X X DMA to save captured counter values into memory
ADC1 X X ADC to monitor to CC1 and CC2 voltage (channel 2 and 3)
SPI1 X SPI for transmitting messages
DMA2 stream 3 X DMA channel for SPI transmission
Clone this wiki locally