PUYA ISP Programmer

Flash PUYA PY32 microcontrollers (PY32F002A, PY32F003, PY32F030, PY32F07x, PY32F040, PY32F403, PY32F303) with a cheap USB-to-serial converter and the bootloader built into every chip. Write BIN and HEX files, erase, lock and unlock the chip and set the nRST pin.

Firmware

    Put the chip into bootloader mode, choose Flash firmware and select the converter's serial port. The chip is erased, the firmware written and verified byte by byte, and the chip starts it.

    Chip

    Shows the chip family, bootloader version and option bytes. The chip stays in bootloader mode.

    Erases the whole flash.

    Removes the read protection. This erases the chip and resets the option bytes.

    Option bytes

    Sets the read protection. The flash can then not be read until the chip is unlocked (and erased).

    Uses the reset pin (PF2 on PY32F002A/F003/F030) as a normal I/O pin. Not available on the PY32F403/F303.

    Makes the pin the reset pin again.

    Writes the factory defaults of the option bytes.

    Wiring and bootloader mode

    Connect the converter to the chip (3.3 V or 5 V, as the chip is powered):

    Converter   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
       VCC  --> VCC                     VCC             VCC
       GND  --> GND                     GND             GND

    Unused RX pins of the bootloader UARTs should not float (use pull-up resistors). The PY32F002B and PY32L020 have no UART bootloader and cannot be flashed this way.

    Then start the bootloader in ONE of these ways:

    • While powering up: unplug the converter, pull BOOT0 (PF4 on PY32F002A/F003/F030) to VCC or hold the BOOT button, plug the converter in and release BOOT0.
    • With a reset: pull BOOT0 to VCC, briefly pull nRST to GND, release BOOT0 (or hold BOOT, press and release RESET, release BOOT).
    • Automatically: with a CH340X converter whose control lines are wired to nRST and BOOT0, the app starts the bootloader by itself and resets the chip afterwards.