ES: PY32F0xx Microcontroller

The PY32F0xx is a family of ARM Cortex-M0 based microcontrollers from Puya Semiconductor. This post covers the peripheral set, pin layout organization, and available firmware examples for getting started with PY32F0xx development.

The PY32F0xx series is the entry-level line of Puya's microcontroller family. Based on the ARM Cortex-M0 core, it targets applications that need reliable 32-bit processing at a price point competitive with 8-bit microcontrollers.


PY32F0xx Overview

The PY32F0xx series microcontrollers are based on the ARM Cortex-M0 core running at up to 48 MHz. They are designed for:

  • Cost-sensitive embedded applications
  • IoT sensor nodes
  • Consumer electronics
  • Simple industrial control

md
+---------------------------------------------+
|         PY32F0xx Block Diagram               |
|                                             |
|  ARM Cortex-M0         Flash Memory         |
|  (up to 48 MHz)   <--> (32–256 KB)          |
|                                             |
|  SRAM (2–32 KB)    <--> AHB Bus             |
|                                             |
|  APB Peripherals:                           |
|  GPIO, USART, SPI, I2C, ADC, DAC           |
|  Timers, DMA, Watchdog, RTC                |
+---------------------------------------------+


PY32F0xx Peripheral Set

Every PY32F0xx variant includes a comprehensive set of integrated peripherals:

GPIO (General Purpose Input/Output)

  • Configurable as digital input or output
  • Multiple modes: floating input, pull-up, pull-down, push-pull output, open-drain output
  • Alternate function mode for peripheral pins
  • External interrupt capability on any GPIO pin

ADC (Analog-to-Digital Converter)

  • 12-bit resolution — values range from 0 to 4095
  • Multiple input channels shared with GPIO pins
  • Configurable sampling time per channel
  • Software and hardware trigger support
  • Single conversion and continuous conversion modes

DAC (Digital-to-Analog Converter)

  • Generates analog output voltage from digital values
  • Applications: audio output, reference voltage generation, analog waveform synthesis

Timers

  • General-purpose timers for time-based events
  • Advanced timers with PWM output for motor control and LED dimming
  • Basic timers for precise delay generation
  • Input capture mode for frequency measurement

USART (Universal Synchronous/Asynchronous Receiver/Transmitter)

  • Full USART (not just UART) — supports synchronous mode
  • Configurable baud rate, word length, parity, and stop bits
  • Hardware flow control (RTS/CTS)

SPI (Serial Peripheral Interface)

  • High-speed synchronous serial communication
  • Master and slave operation
  • Configurable clock polarity and phase (all four SPI modes)
  • DMA support for large transfers

I2C (Inter-Integrated Circuit)

  • Standard mode (100 kHz) and Fast mode (400 kHz)
  • 7-bit and 10-bit addressing
  • Multi-master support
  • Interrupt-driven and DMA transfers

PWM (Pulse Width Modulation)

  • Multiple PWM channels via timer peripherals
  • Used for motor control, LED brightness, servo positioning, and buzzer tones

DMA (Direct Memory Access)

  • Transfers data between peripherals and memory without CPU involvement
  • Reduces CPU load for high-throughput operations (UART, SPI, ADC)

Watchdog Timer

  • Resets the system if firmware hangs or enters an infinite error loop
  • Independent watchdog operates even when the main clock fails

Pin Layout Organization

Pin assignments vary by specific PY32F0xx model number, but the general structure is consistent:

Power Pins

PinDescription
VDD / VCCDigital power supply (1.7V – 3.6V)
VSS / GNDDigital ground
VDDAAnalog power supply for ADC and DAC
VSSAAnalog ground reference

GPIO Pins

GPIO pins are arranged in ports (GPIOA, GPIOB, GPIOF) and can be reassigned to peripheral alternate functions:

  • USART pins: TX, RX (alternate function on GPIO)
  • SPI pins: MOSI, MISO, SCK, NSS (alternate function on GPIO)
  • I2C pins: SCL, SDA (alternate function on GPIO)
  • ADC pins: Dedicated analog input channels
  • PWM pins: Timer output channels

Serial Communication Pins

InterfaceSignalTypical Pin
USARTTXPA1, PA9
USARTRXPA0, PA10
SPIMOSIPA7
SPIMISOPA6
SPISCKPA5
SPINSSPA4
I2CSCLPA3, PF1
I2CSDAPA2, PF0

Debug Interface Pins

SignalPinDescription
SWD_IOPA13SWD data
SWD_CLKPA14SWD clock
NRSTPF2Reset pin

External Interrupt Pins

All GPIO pins can be configured as external interrupt sources. The EXTI (External Interrupt) controller maps GPIO pins to interrupt lines, supporting:

  • Rising edge trigger
  • Falling edge trigger
  • Both edges trigger

PY32F0xx Firmware Examples

Official firmware examples and HAL library are available from the OpenPuya GitHub repository:

bash
https://github.com/OpenPuya/PY32F0xx_Firmware/tree/master/Projects

The repository contains examples for:

ExampleDescription
GPIO_OutputHighBasic GPIO output control
USART_PrintfUART serial output
ADC_SingleConversionSingle ADC channel reading
SPI_FullDuplexMasterITSPI with interrupts
I2C_TwoBoardsI2C master/slave communication
TIM_PWMPWM generation
PWR_STOP_WakeUpByLPTIMLow-power stop mode

PY32F0xx Variant Comparison

Part NumberFlashRAMPinsPackage
PY32F002A20 KB3 KB20TSSOP20, SOP8
PY32F00332 KB4 KB20TSSOP20
PY32F03064 KB8 KB32–64QFN32, LQFP64

For most simple IoT applications, the PY32F003 (32 KB flash, 4 KB RAM, TSSOP20) provides sufficient resources.


Final Thoughts

The PY32F0xx series delivers ARM Cortex-M0 capability in an affordable, well-integrated package. Its peripheral set covers the needs of most IoT and embedded applications, and the growing community around OpenPuya is expanding the available firmware examples and HAL support.

The combination of a mature ARM toolchain, standard SWD debugging, and a comprehensive peripheral set makes the PY32F0xx a practical choice for cost-sensitive designs.

PY32F0xx: ARM Cortex-M capability at a price that changes what is possible in high-volume embedded design.