From the bench

PY32F002B: A Practical Bring-Up and Integration Guide for Hardware Engineers

August 28, 2026 · AI-generated from the datasheet, fact-checked by two independent LLM critics

The PY32F002B is an entry-level 32-bit Arm Cortex-M0+ microcontroller from Puya, running at up to 24 MHz with 24 KB of flash and 3 KB of SRAM, in compact packages (QFN20, TSSOP20, SOP16, SOP14, MSOP10). It integrates a 12-bit ADC, two internal comparators, multiple timers (advanced, general, and low-power), an independent watchdog (IWDG), USART, SPI, I²C, and SWD debug, all on a wide 1.7 V–5.5 V supply. That supply range is the headline: it runs directly off a Li-ion cell or a loose 3–5 V rail with no external LDO, making it a natural fit for battery-powered sensor nodes, low-cost embedded control, and motor/PWM control loops where you'd otherwise reach for an 8- or 16-bit part. The datasheet positions the M0+ core as an upgrade path from 8/16-bit MCUs — better code density, a unified 32-bit toolchain, ultra-low power operation — without adding cost or board area.

Next step
Start building with PY32F002B → This guide comes from the same grounded, cited datasheet answers — ask the assistant your own PY32F002B questions.

Before you lock in a part number: the datasheet's ordering-information section (Section 7) provides the decode diagram mapping orderable part-number suffixes to these physical packages — the suffix-to-package mapping isn't obvious from the package list alone, so consult it to select the correct footprint and variant.

Think of this post as a bench sign-off procedure: a sequence of checks to run as you integrate the part into a design, and a second set to run once the board is alive. Each check is tied to a specific datasheet value so you know exactly what "pass" looks like.

Check 1: Power Supply and Reset (What rails and reset thresholds do I need to design for?)

Start with the supply, because it drives everything else on the board.

BOR_LEV Rising threshold Falling threshold
000 1.8 V (1.7 / 1.9) 1.7 V (1.6 / 1.8)
001 2.0 V (1.9 / 2.1) 1.9 V (1.8 / 2.0)
010 2.2 V (2.1 / 2.3) 2.1 V (2.0 / 2.2)
011 2.4 V (2.3 / 2.5) 2.3 V (2.2 / 2.4)
100 2.6 V (2.5 / 2.7) 2.5 V (2.4 / 2.6)
101 2.8 V (2.7 / 2.9) 2.7 V (2.6 / 2.8)
110 3.0 V (2.9 / 3.1) 2.9 V (2.8 / 3.0)
111 3.2 V (3.1 / 3.3) 3.1 V (3.0 / 3.2)

BOR hysteresis is 100 mV typ, and the POR/PDR thresholds sit below all BOR levels (rising 1.6 V typ, falling 1.55 V typ, 50 mV PDR hysteresis). The key takeaway: on battery designs with soft discharge curves, pick a BOR level above your minimum valid operating point so the MCU resets cleanly instead of hanging in a nondeterministic low-voltage state. One subtlety — if your design must genuinely run down at the 1.7 V floor, BOR level 000's falling threshold max (1.8 V) sits above your operating minimum, so you can't simultaneously guarantee operation at 1.7 V and have BOR trip with useful margin below it. In that case, disable BOR and rely on PDR alone.

Check 2: Surrounding Components (What goes around the chip?)

Check 3: Clocking (Do I need a crystal?)

Check 4: Analog Setup (How do I get good ADC and comparator readings?)

This is where the PY32F002B has part-specific quirks you won't find on a generic M0+:

Check 5: Low-Power Strategy (How do I budget battery life?)

Known limitation: the datasheet does not publish decoupling-capacitor values, a GPIO weak-pull resistance, or an injection-current (IINJ) specification. Those surrounding-component decisions must come from general practice and your own validation, not the spec.

Post-Integration Verification (How do I test it?)

Before you test anything, note the datasheet's own warning on typical values: they're based on T_A = 25 °C and V_CC = 3.3 V and are for design guidance only, not tested. ADC accuracy is characterized as 95% of chips within the given number across temperature. Treat every "typ" figure below as a deviation flag, not a hard pass/fail line.

  1. Rail check. Apply 1.7–5.5 V and scope for overshoot past the 6.25 V abs-max at power-up and undershoot below −0.3 V. Verify pin inputs stay within VCC ± 0.3 V under all conditions, including connector transients.
  2. Current sanity. Measure run-mode IDD against ~1.1 mA at 24 MHz (flash on) — an early catch for clock or peripheral misconfiguration. Measure Stop current and determine which regulator regime you're in (75.3 µA vs 1.1–1.7 µA).
  3. Brown-out sweep. Ramp the rail down through your chosen BOR level and confirm reset occurs near the falling threshold with ~100 mV of hysteresis — e.g. level 110 should reset falling from ~2.9 V, level 111 from ~3.1 V. Confirm a clean reset with no hang mid-droop.
  4. Clock verification. Confirm the core boots at 24 MHz HSI. If you use the LSI, measure it and check your timebase margins against the ±10–20 % drift.
  5. Analog settle checks. After each wake or reset, wait ≥ 15 µs (max) before the first ADC or comparator read. Verify the temperature sensor path uses ≥ 9 µs sample time and 70–120 µs startup, and cross-check readings against a known-good sensor.
  6. Wake behavior. Confirm the comparator wakes the device from Sleep and Stop via EXTI using the on-chip threshold ladder.
  7. ESD/EFT qualification. Design test coupons to the published withstand levels: 6 kV HBM, 1 kV CDM, 200 V MM, 200 mA latch-up, 2 kV I/O and 4 kV power EFT. A board failing below 6 kV HBM at connector-facing pins means your clamps are inadequate.
  8. Peripheral and memory checkout. Enable each block one at a time and watch the current delta — advanced TIM1, general and low-power timers, SysTick, IWDG, SPI, I²C, USART, and two comparators are all on this part. Run a stack/free-RAM check against the 3 KB SRAM budget.
  9. SWD recoverability. After configuring GPIOs (including the config lock), verify you can still reconnect SWD and re-flash. Do this before production, on every firmware that touches pin configuration.
  10. Thermal check. The explicit operating range is T_A = −40 to +85 °C with T_J = −40 to +90 °C. At +85 °C ambient you have only 5 °C of junction headroom; with sub-1.1 mA run currents self-heating is negligible, but don't stack full-speed operation in a hot enclosure without margin.

Troubleshooting (What do I check when it misbehaves?)

⚠ Not production tested: several specification tables — GPIO port characteristics, ADC values, POR/BOR rows, flash endurance — are explicitly labeled as based on core verification or assessment, not production tested. In the datasheet itself, this caveat appears only as small-print footnote paragraphs beneath each table's rows (referenced by superscript markers), not as a visually distinct callout — so it's easy to miss. That doesn't make the values wrong, but it means your own bench measurements are the real qualification. Leave margin wherever a typical value is load-bearing.

Part page: PY32F002B.