Skip to content
Manuel Bl edited this page Apr 25, 2023 · 2 revisions

The STM32 F1 family includes popular MCUs like the STM32F103C8 found on the popular Blue Pill board.

Supported MCUs / Boards

  • STM32F103C8 (used on Blue 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
PA15 A15 CC_3V3 X X Timer 2, channel 1, input capture EXTI interrupt
PA2 A2 CC_3V3 X X Timer 2, channel 3, input capture
PA1 A1 CC1 X X ADC1, channel 1
PA0 A0 CC2 X X ADC1, channel 0
PB5 B5 CC1_TX X SPI1 MOSI
PA8 A8 CC1_TX_EN X GPIO output
PA7 A7 CC2_TX X SPI1 MOSI
PA6 A6 CC2_TX_EN X GPIO output
PB3 B3 DEBUG (X) (X) Optional. GPIO output

Note that both CC_3V3 pins must be connected. Input capture in the STM32F1 family only works either on the rising or the falling edge. Since both edges are relevant, two separate input capture channels and two pins are used.

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.

The MCU has multiple ADCs. Use analogRead() only with pins using ADC2. (Please provide information about which pin uses which ADC if you know.)

Furthermore, SPI1 is not available if the library is run in power sink mode. Use one of the other SPI peripherals (and associated pins) if needed.

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