Skip to main content

picpro a kitsrus PIC CLI programmer

This is complete rewrite of kitsrus_pic_programmer into Python 3 + bunch of fixes and features.

Tox tests

Supported kitsrus programmers

  • K128
  • K149 version A to F
  • K150 (Tested)
  • K182

Note: The programmer must have the latest firmware version, which utilizes the P18A protocol. Firmware versions using older protocols (P018, P016, P014, or earlier) are not supported.

See https://www.kitsrus.com/pic.html.

Installation

PIP (pip3 on some distros)

pip install picpro

Repository

You can also use these repositories maintained by me

Debian and derivatives

Add repository by running these commands

wget -O- https://repository.salamek.cz/deb/salamek.gpg | sudo tee /usr/share/keyrings/salamek-archive-keyring.gpg
echo "deb     [signed-by=/usr/share/keyrings/salamek-archive-keyring.gpg] https://repository.salamek.cz/deb/pub all main" | sudo tee /etc/apt/sources.list.d/salamek.cz.list

And then you can install a package picpro

apt update && apt install picpro

Archlinux

Add repository by adding this at end of file /etc/pacman.conf

[salamek]
Server = https://repository.salamek.cz/arch/pub/any
SigLevel = Optional

and then install by running

pacman -Sy picpro

Desktop GUI

The desktop interface is distributed separately as picpro-gui. It uses the PicPro application API described below.

Application API

PicPro provides synchronous workflows without importing the CLI, printing, installing signal handlers, or selecting process exit codes:

from pathlib import Path

from picpro.PicPro import PicPro, StageEvent, Target


def handle_event(event):
    if isinstance(event, StageEvent):
        print(event.stage.value)  # Replace with CLI formatting or a GUI signal.


service = PicPro(on_event=handle_event)
target = Target(port="/dev/ttyUSB0", chip_name="12f675", icsp=True)
result = service.program(target, Path("firmware.hex"))
if not result.success:
    # The caller decides how to present verification failure.
    pass

The service also exposes verify, erase, read_memory, read_config, programmer_info, list_chips, get_chip, inspect_hex, decode_fuses, and migrate_chip_data. Memory reads return device bytes; output file formats belong to the interface. Verification returns a VerificationResult with ROM and optional EEPROM outcomes. Operational failures propagate as exceptions.

Callbacks receive StageEvent, ChipConfigEvent, or VerificationEvent on the calling thread. Configuration events contain snapshots; verification events include expected and actual bytes. A GUI should call workflows in a worker and marshal events onto its UI thread. Inject chip_data and connection_factory when using custom definitions or testing without hardware.

Pass should_cancel=cancel_event.is_set to device workflows for cooperative cancellation, which raises OperationCancelledError. Cancellation is checked between complete commands, including before PIC18 fuse commits. Current events report workflow stages; they do not report transfer byte counts or interrupt an active transfer or erase command. Connections are released when workflows, event handlers, or cancellation raise exceptions.

Chip definitions

Normal commands use one YAML file per chip in chip-data.d. The first existing chip directory is selected, in this order:

  1. chip-data.d inside the user's picpro data directory (usually ~/.local/share/picpro/chip-data.d on Linux).
  2. /usr/share/picpro/chip-data.d.
  3. chip-data.d next to the installed picpro Python package.
  4. The bundled picpro/data/chip-data.d definitions.

The selected directory supplies the entire chip database. Copy the bundled YAML files into your custom directory if you want to keep all supported chips while editing individual definitions.

Legacy chipdata.cid files are no longer used by normal commands. The CID parser and legacy database remain available for compatibility and conversion. To migrate custom definitions into the user's YAML directory, run:

picpro chipdata_migrate /path/to/chipdata.cid

Use --output=/path/to/chip-data.d to choose another destination. Running picpro chipdata_migrate without an input path searches the legacy user, system, package-adjacent, and bundled CID locations. Conversion creates the destination and replaces YAML files for chips found in the input database.

Usage

The CLI uses Typer. Run picpro --help to list commands and picpro COMMAND --help for command-specific arguments and options. Existing command names (including underscores) and short options are preserved.

Command details:
    program             Program PIC chip.
    verify              Verify PIC flash.
    dump                Dump PIC data as binary.
    erase               Erase PIC.
    chip_info           Print chip definitions as JSON.
    programmer_info     Print programmer firmware and protocol versions.
    read_chip_config    Read chip identification, calibration, and fuses.
    decode_fuses        Decode fuse words into named settings.
    chipdata_migrate    Convert legacy CID chip definitions to YAML.
    hex_info            Print information about a hex file.

Usage:
    picpro program -p PORT -i HEX_FILE -t PIC_TYPE [--id=PIC_ID] [--fuse=FUSE_NAME:FUSE_VALUE...] [--icsp]
    picpro verify -p PORT -i HEX_FILE -t PIC_TYPE [--icsp]
    picpro erase -p PORT -t PIC_TYPE [--icsp]
    picpro dump <mem_type> -p PORT -o HEX_FILE -t PIC_TYPE [--icsp] [--binary]
    picpro chip_info [<PIC_TYPE>]
    picpro hex_info <HEX_FILE> <PIC_TYPE>
    picpro programmer_info -p PORT
    picpro read_chip_config -p PORT -t PIC_TYPE [--icsp]
    picpro decode_fuses <fuses> -t PIC_TYPE
    picpro chipdata_migrate [<CID_FILE>] [--output=OUTPUT_DIR]
    picpro (-h | --help)
    picpro (-v | --version)


Options:
    --icsp                           Enable ISCP programming.
    --fuse=FUSE_NAME:FUSE_VALUE      Set fuse value directly.
    --id=PIC_ID                      Set PIC id to be programmed in pic.
    -p PORT --port=PORT              Set serial port where programmer is connected.
    -t PIC_TYPE --pic_type=PIC_TYPE  Pic type you are programming/reading.
    -i HEX_FILE --hex_file=HEX_FILE  Hex file to flash or to read.
    -o HEX_FILE --hex_file=HEX_FILE  Hex file to write.
    --binary                         Input/Output file is in binary.
    -v --version                     Display version info

Example: Program chip

picpro program -p /dev/ttyUSB0 -i YOUR_HEX_FILE.hex -t 12F675

Example: Verify chip program

picpro verify -p /dev/ttyUSB0 -i YOUR_HEX_FILE.hex -t 12F675

Example: Dump ROM as hex file

picpro dump rom -p /dev/ttyUSB0 -o rom.hex -t 12F675

Example: Dump EEPROM as hex file

picpro dump eeprom -p /dev/ttyUSB0 -o eeprom.hex -t 12F675

Example: Dump CONFIG as hex file

picpro dump config -p /dev/ttyUSB0 -o config.hex -t 12F675

Example: Program chip via ISCP

picpro program -p /dev/ttyUSB0 -i YOUR_HEX_FILE.hex -t 12F675 --icsp

Example: Program chip and override fuses provided from HEX file

picpro program -p /dev/ttyUSB0 -i YOUR_HEX_FILE.hex -t 12F675 --fuse=FUSE_NAME:FUSE_VALUE --fuse=FUSE_NAME:FUSE_VALUE

Enable serial port access

To allow the user to access the serial ports (for some distros), run the following command:

sudo usermod -a -G dialout $USER

Metadata

Release files for picpro 0.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 picpro 0.5.0
File Size Uploaded Provenance Actions
picpro-0.5.0.tar.gz 97.5 kB Without provenance Details for picpro-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 306.1 kB

Release files / picpro-0.5.0.tar.gz

Download URL picpro-0.5.0.tar.gz
Size 97.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6cad93f3cc5e5900a1f16bf7444ca50b8ad86c08b5c74f35e097bf1b8c909ac1
BLAKE2b-256 checksum
How to use checksums
0e3ee888ea8c8d42178952295b6e6ab028a7d5b547cb4d2c67fa37fecacfb4e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / picpro-0.5.0-py3-none-any.whl

Download URL picpro-0.5.0-py3-none-any.whl
Size 208.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dafc2127f520dabf8058ac924924ec8fc391db8e7f71c0f01e73db5fd115b370
BLAKE2b-256 checksum
How to use checksums
2b4612159fdc6c68775ee5e8d24d5a73103e1762d826d4afa5a8d2801f512786
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for picpro 0.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