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]

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

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

Metadata

Release files for puyaisp 1.5.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.5.0
File Size Uploaded Provenance Actions
puyaisp-1.5.0.tar.gz 11.7 kB Without provenance Details for puyaisp-1.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 22.8 kB

Release files / puyaisp-1.5.0.tar.gz

Download URL puyaisp-1.5.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
327610f8c43e87806ed150f2103070f93f130f4cf210def139bdfc47ef6ab08b
BLAKE2b-256 checksum
How to use checksums
845fcd1224eb51e2196b1203e406101c03f0d26147d8c15cc6c3ff1c7ff7f592
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.5.0-py3-none-any.whl

Download URL puyaisp-1.5.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a0b9ee3e43b2ef70be730961422d4b8566325f8e090c4d6fa8b8ff26d82bd88
BLAKE2b-256 checksum
How to use checksums
6a7b05bfc59d2a03ce8798a616cea63b9a61b2d06dff90f1e59e09d4db36edc2
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.5.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