ES: PY32 Pinout

The PY32F003 pinout in TSSOP20 package maps 20 pins to GPIO, ADC, SPI, I2C, UART, SWD debug, and power signals. Understanding the pin layout is the starting point for any PY32 hardware design or firmware development project.

The PY32F003 is available in a compact TSSOP20 package — 20 pins that cover everything needed for a functional embedded system. This pinout guide covers the physical pin assignment, alternate functions, and practical notes for circuit design and firmware development.


PY32F003-F1xPx TSSOP20 Pinout

The PY32F003 in TSSOP20 package has 20 pins in a dual in-line arrangement.

Physical Pin Diagram (Low-Level, TSSOP20F1 Package)

md
PY32F003F1xPx TSSOP20F1 (Top View)
         +---------+
  PA2 ---| 1    20 |--- PA1
  PA3 ---| 2    19 |--- PA0
  PA4 ---| 3    18 |--- PF2-NRST
  PA5 ---| 4    17 |--- PF1
  PA6 ---| 5    16 |--- PF0
  PA7 ---| 6    15 |--- PF4
  Vss ---| 7    14 |--- PB7
 PA12 ---| 8    13 |--- PB6
  Vcc ---| 9    12 |--- PB5
PA13-SWD ---| 10   11 |--- PA14-SWC
         +---------+


Annotated Pinout (Development Board Layout)

This diagram shows the same pins with alternate function labels, as typically found on PY32F003F18P breakout boards:

md
                             PY32F003F18P
                            +---------+
                        5V ---|         |--- 3V3    (Power: 3.3V)
                       GND ---|      15 |--- F4     (GPIO, BOOT)
  (ADC_IN2, I2C_SDA)   A2 ---| 1    20 |--- A1     (ADC_IN1, USART_TX)
  (ADC_IN3, I2C_SCL)   A3 ---| 2    19 |--- A0     (ADC_IN0, USART_RX)
   (ADC_IN4, SPI_NSS)  A4 ---| 3    18 |--- F2     (GPIO, NRST)
   (ADC_IN5, SPI_SCK)  A5 ---| 4    17 |--- F1     (GPIO, I2C_SCL)
  (ADC_IN6, SPI_MISO)  A6 ---| 5    16 |--- F0     (GPIO, I2C_SDA)
  (ADC_IN7, SPI_MOSI)  A7 ---| 6    14 |--- B7     (GPIO, ADC_IN7)
               (PWM)  A12 ---| 8    13 |--- B6     (GPIO, ADC_IN6)
       (SWD_IO, Debug) A13 ---| 10   12 |--- B5     (GPIO, ADC_IN5, PWM) LED
                       3V3 ---|      11 |--- A14    (SWD_CLK, Debug)
                       3V3 ---|         |--- GND
                       GND ---|         |--- GND
                            +---------+


Pin Function Table

PinPortPrimary FunctionAlternate Functions
1PA2GPIOADC_IN2, I2C_SDA, USART_TX
2PA3GPIOADC_IN3, I2C_SCL, USART_RX
3PA4GPIOADC_IN4, SPI_NSS, TIM_CH2
4PA5GPIOADC_IN5, SPI_SCK, TIM_CH1
5PA6GPIOADC_IN6, SPI_MISO, TIM_CH1
6PA7GPIOADC_IN7, SPI_MOSI, TIM_CH2
7VSSPowerGround
8PA12GPIOPWM output, TIM_CH2
9VCCPower3.3V supply
10PA13DebugSWD_IO (do not use for GPIO)
11PA14DebugSWD_CLK (do not use for GPIO)
12PB5GPIOADC_IN5, PWM, onboard LED
13PB6GPIOADC_IN6
14PB7GPIOADC_IN7
15PF4GPIOBOOT0 control
16PF0GPIOI2C_SDA (alternate)
17PF1GPIOI2C_SCL (alternate)
18PF2ResetNRST (hardware reset)
19PA0GPIOADC_IN0, USART_RX
20PA1GPIOADC_IN1, USART_TX

Communication Interface Pin Mapping

USART (Serial Communication)

SignalPinPort
TXPin 20PA1
RXPin 19PA0

Alternate USART pins are available via the GPIO alternate function remapping register.

SPI

SignalPinPort
NSS (CS)Pin 3PA4
SCKPin 4PA5
MISOPin 5PA6
MOSIPin 6PA7

I2C

Two sets of I2C pins are available:

SetSDASCL
PrimaryPA2 (pin 1)PA3 (pin 2)
AlternatePF0 (pin 16)PF1 (pin 17)

SWD Debug Interface

SignalPinPortNote
SWD_IOPin 10PA13Reserved for debug — do not use as GPIO
SWD_CLKPin 11PA14Reserved for debug — do not use as GPIO

ADC Channel Mapping

The PY32F003's 12-bit ADC channels are mapped to GPIO pins:

ADC ChannelPinPort
ADC_IN0Pin 19PA0
ADC_IN1Pin 20PA1
ADC_IN2Pin 1PA2
ADC_IN3Pin 2PA3
ADC_IN4Pin 3PA4
ADC_IN5Pin 4PA5
ADC_IN6Pin 5PA6
ADC_IN7Pin 6PA7

All ADC channels share GPIO pins. A pin used as ADC input cannot simultaneously be used as digital GPIO.


PWM Pin Notes

PWM outputs are generated through the timer peripheral channels. Available PWM pins on PY32F003:

PWM ChannelPinPort
TIM1_CH1 / TIM1_CH2PA4, PA5, PA6, PA7Port A
TIM3_CH1PA12Port A
TIM3_CH2PB5 (LED)Port B

PB5 is connected to the onboard LED on most development boards — useful for quick visual feedback during PWM testing.


Boot Mode Control

PF4 controls boot mode selection:

PF4 StateBoot Mode
HIGH (pull-up)Normal boot from flash
LOW (pull to GND)Boot from system memory (ISP mode)

In ISP (In-System Programming) mode, the device can be programmed via USART without an SWD debugger.


Practical Pin Selection Guide

md
Digital output (LED, relay)?    → PA5, PA6, PA7, PB5, PB6, PB7
Digital input (button)?         → Any GPIO pin (use pull-up mode)
USART communication?            → PA1 (TX), PA0 (RX)
SPI peripheral?                 → PA4 (NSS), PA5 (SCK), PA6 (MISO), PA7 (MOSI)
I2C sensor bus?                 → PA2 (SDA), PA3 (SCL)
ADC analog reading?             → PA0–PA7 (ADC_IN0–ADC_IN7)
PWM output?                     → PA4–PA7, PA12, PB5
Debug connection?               → PA13 (SWD_IO), PA14 (SWD_CLK)
Reset?                          → PF2 (NRST)


Final Thoughts

The PY32F003 TSSOP20 pinout packs a complete embedded system into 20 pins. The careful overlap between GPIO, ADC, SPI, I2C, and USART functions on the same physical pins gives hardware designers flexibility in how they route the board.

The key constraint to remember: PA13 and PA14 are dedicated to SWD debugging and should not be used for GPIO in production without disabling the debug port — which prevents future firmware updates via SWD.

Understanding the PY32 pinout is the foundation of every hardware design and firmware configuration for this chip.