Skip to main content

pybldc

Developed by Kristian Sloth Lauszus, 2024-2025

The code is released under the GNU General Public License v3.0.


PyPI CI Coverage badge

Purpose

This tool allows you to flash a VESC via CAN-bus or serial/USB using Python.

Installation and running

To install:

pip install .

Or install the latest release from PyPI:

pip install -U pybldc

CLI

A handy CLI tool is included.

I recommend using uvx to run the CLI tool:

uvx pybldc --help

Or you can install it in your path:

uv tool install pybldc
pybldc --help

Usage

usage: pybldc [-id CONTROLLER_ID] [-i INTERFACE] [-l CHANNEL] [-p PORT] [-h]
              [--version] [-B BINARY] [--bootloader] [-t TIMEOUT]
              [-r PING_REPEAT] [-b BAUDRATE] [--debug]
              {can,serial} {upload,ping,reset}

positional arguments:
  {can,serial}          Communicate with the target via either CAN or serial
  {upload,ping,reset}   upload: write BINARY
                        ping: send a ping command to the target and check for a response
                        reset: send a reset command to the target and check for a response

required CAN arguments:
  -id CONTROLLER_ID, --controller-id CONTROLLER_ID
                        The VESC ID used for communication

optional CAN arguments:
  -i INTERFACE, --interface INTERFACE
                        The CAN-Bus interface to use (default "socketcan")
  -l CHANNEL, --channel CHANNEL
                        The CAN-Bus channel to use (default "can0")

required serial arguments:
  -p PORT, --port PORT  The port to use for serial

optional arguments:
  -h, --help            Show this help message and exit
  --version             Show program's version number and exit
  -B BINARY, --binary BINARY
                        The binary to upload
  --bootloader          The binary to upload is a bootloader
  -t TIMEOUT, --timeout TIMEOUT
                        The time to wait in seconds for a response (default 5.0)
  -r PING_REPEAT, --ping-repeat PING_REPEAT
                        The number of times to try to establish a connection by pinging the VESC (default 3)
  -b BAUDRATE, --baudrate BAUDRATE, --bitrate BAUDRATE
                        The baudrate/bitrate to use for serial/can (defaults to 115200 for serial and 500000 for CAN)
  --debug               Turn on debug logs

Upload

uvx pybldc can upload -id 1 -B VESC.bin
uvx pybldc serial upload -p /dev/ttyACM0 -B VESC.bin

Ping

uvx pybldc can ping -id 1
uvx pybldc serial ping -p /dev/ttyACM0

Reset

uvx pybldc can reset -id 1
uvx pybldc serial reset -p /dev/ttyACM0

Increase TX buffer

On Linux you might need to increase the TX buffer size:

sudo ip link set can0 txqueuelen 1000

Credit

Metadata

Release files for pybldc 1.1.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 pybldc 1.1.0
File Size Uploaded
pybldc-1.1.0.tar.gz 38.3 kB Details

Built distribution (wheel)

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

Total release size: 66.6 kB

Release files / pybldc-1.1.0.tar.gz

Download URL pybldc-1.1.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1f44f07e00af25594dabe37e3c4c3a292cc147cc679125ba89957bd1f1c5cf29
BLAKE2b-256 checksum
How to use checksums
8c2a8a14e4937ff25ad8039e5bdf269aa9aa0f335616672c427720af3b262620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pybldc-1.1.0-py3-none-any.whl

Download URL pybldc-1.1.0-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6d3015c31fa09065baccf85610a3183d0badf7854956713c80e562d698f1e95
BLAKE2b-256 checksum
How to use checksums
a737a371903c9b9c167764da1a478f5079b0b6233bb7a6cec94e7668bf03a561
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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