Skip to main content

Programming Tool for PUYA PY32 Microcontrollers

Description

With this tool, PUYA PY32 microcontrollers can be flashed via a simple USB-to-serial converter by utilizing the factory built-in embedded UART/HID bootloader.

Supported microcontrollers (identified by the bootloader PID):

Bootloader PID Microcontrollers Interfaces
0x440 PY32F002A, PY32F003, PY32F030 UART
0x448 PY32F071, PY32F072, PY32F040 UART, USB HID
0x413 PY32F403, PY32F303 UART

Other PY32 microcontrollers with the same bootloader protocol can be flashed as well, but their option bytes cannot be changed. PY32F002B and PY32L020 have no UART bootloader in system memory and are not supported.

Preparations

If necessary, a driver for the USB-to-serial converter used must be installed.

Installation

Ensure that the prerequisites for installing Python packages are met. Then execute the following command in the command line:

pip install puyaisp

Usage

Connect your USB-to-serial converter to your PY32 MCU as follows:

USB2SERIAL      PY32F002A/F003/F030    PY32F07x/F040    PY32F403/F303
+--------+
|     RXD| <--- PA2 or PA9  or PA14    PA9  or PA14     PA9  or PB10
|     TXD| ---> PA3 or PA10 or PA15    PA10 or PA15     PA10 or PB11
|     VDD| ---> VDD                    VDD              VDD
|     GND| ---> GND                    GND              GND
+--------+

Unused RX pins of the bootloader UARTs should not float (use pull-up resistors).

Set your MCU to bootloader mode by using ONE of the following methods:

  • Disconnect your USB-to-serial converter, pull BOOT0 pin (PF4) to VCC (or press and hold the BOOT button, if your board has one), then connect the converter to your USB port. BOOT0 pin (or BOOT button) can be released now.
  • Connect your USB-to-serial converter to your USB port. Pull BOOT0 pin (PF4) to VCC, then pull nRST (PF2) shortly to GND (or press and hold the BOOT button, then press and release the RESET button and then release the BOOT button, if your board has them).
  • If your microcontroller has USB, pull BOOT0 pin (PF4) to VCC (or press and hold the BOOT button, if your board has one), then connect it to your USB port. The default USB VID:PID is ffff:0448.
Usage: puyaisp [-h] [-u] [-l] [-e] [-o] [-G] [-R] [-t {serial,hid}] [-f FLASH]
               [--vid VID] [--pid PID] [--path PATH]
               [--timeout TIMEOUT] [--list]

Optional arguments:
  -h, --help                     show this help message and exit
  -u, --unlock                   unlock chip (remove read protection)
  -l, --lock                     lock chip (set read protection)
  -e, --erase                    perform chip erase (implied with -f)
  -o, --rstoption                reset option bytes
  -G, --nrstgpio                 make nRST pin a GPIO pin
  -R, --nrstreset                make nRST pin a RESET pin
  -t, --transport {serial,hid}   bootloader transport
  -f FLASH, --flash FLASH        write BIN file to flash and verify
  --vid VID                      HID VID
  --pid PID                      HID PID
  --path PATH                    hidapi device path
  --timeout TIMEOUT              read timeout in ms
  --list                         list supported chips

Examples:
puyaisp -f firmware.bin
puyaisp -t hid -f firmware.bin

Without action arguments, puyaisp shows the chip, its flash size and its option bytes (or that the chip is locked) and then starts the firmware.

Metadata

Release files for puyaisp 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for puyaisp 1.6.0
File Size Uploaded Provenance Actions
puyaisp-1.6.0.tar.gz 10.7 kB Without provenance Details for puyaisp-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for puyaisp 1.6.0
File Interpreter ABI Platform Actions
puyaisp-1.6.0-py3-none-any.whl Python 3 none any Details for puyaisp-1.6.0-py3-none-any.whl

Total release size: 20.7 kB

Release files / puyaisp-1.6.0.tar.gz

Download URL puyaisp-1.6.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b1f7e0e608f34b6b22c851462ce1d9bd36c52d949cd2c06297f83e1c1398f92e
BLAKE2b-256 checksum
How to use checksums
cc32aa00f8fe1a2505381517ec703581e21ece51453dd30fcd6af95ac0140510
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / puyaisp-1.6.0-py3-none-any.whl

Download URL puyaisp-1.6.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
faa5762f7626b233fe84ec3432b7e30fc6de569a1b6eed13409238ded41ca98b
BLAKE2b-256 checksum
How to use checksums
a6f340b8a9815db2ce1310fd24bb4fefcb6147ba64fc0873aa66166bac14e1b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for puyaisp 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page