Skip to main content

python implementation of X2Cscope

Project description

pyX2Cscope Logo

pyX2Cscope

The pyx2cscope Python package communicates with X2Cscope enabled firmwares running on microcontrollers. Focusing real time control applications like motor control and power conversion.

  • It allows user to:
    • Read - Write variables to the embedded target in runtime
    • Record and Plot fast, continuous signals from the target firmware
    • Implement Automated Unit Tests (TDD) and HIL tests for embedded development
    • Record data in run-time for AI models
    • Implement custom user interface, dashboards for embedded applications (QT, Tkinter, Web)

Detailed documentation is hosted at GitHub.io: https://x2cscope.github.io/pyx2cscope/

Install

pyX2Cscope currently supports Python 3.10 to 3.14.

Create a virtual environment and install pyx2cscope using the following commands (Windows):

python -m venv .venv
.venv\Scripts\activate
pip install pyx2cscope

Start GUI

To execute Qt version, type:

   pyx2cscope

To execute the Browser based version type:

   pyx2cscope -w

Basic scripting

from pyx2cscope.x2cscope import X2CScope

# Option 1: Default UART with Auto-detect COM port (recommended for single device)
x2c_scope = X2CScope(elf_file="path/to/firmware.elf")

# Option 2: Specify COM port explicitly
# x2c_scope = X2CScope(port="COM8", elf_file="path/to/firmware.elf")

# Or import variables after instantiation
# x2c_scope.import_variables(r"..\..\tests\data\qspin_foc_same54.elf")

# Collect some variables
speed_reference = x2c_scope.get_variable("motor.apiData.velocityReference")
speed_measured = x2c_scope.get_variable("motor.apiData.velocityMeasured")

# Read the value of the "motor.apiData.velocityMeasured" variable from the target
print(speed_measured.get_value())
# Write a new value to the "motor.apiData.velocityReference" variable on the target
speed_reference.set_value(1000)

Check Examples directory in the pyX2Cscope project to see common uses of this library.

Development

https://github.com/X2Cscope/pyx2cscope/tree/main/doc/development.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyx2cscope-0.7.0.tar.gz (113.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyx2cscope-0.7.0-py3-none-any.whl (117.4 kB view details)

Uploaded Python 3

File details

Details for the file pyx2cscope-0.7.0.tar.gz.

File metadata

  • Download URL: pyx2cscope-0.7.0.tar.gz
  • Upload date:
  • Size: 113.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyx2cscope-0.7.0.tar.gz
Algorithm Hash digest
SHA256 e6127ae2e03c0c01bf4bb1cf359a811d436fc9d5ffa1e573c00e05b2ec1c7036
MD5 49adf2892c71147511303e9bbb8cf072
BLAKE2b-256 56f3d3b5713c2af14caf7dcf7440718a1833bf46047ad578ac703f699b0f16bc

See more details on using hashes here.

File details

Details for the file pyx2cscope-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: pyx2cscope-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 117.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyx2cscope-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f396f609b7d7932991a447665166e34f90a85a71e328962104a08741598a57a1
MD5 107fb5f85aecf76fafc4fdce6abf2784
BLAKE2b-256 441d6af73e3b26497afdcd0f9d1d48aa2823e4f1ad9a126b80ec41fb54e3fb3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page