pykitcommander


Namepykitcommander JSON
Version 2.8.3.18 PyPI version JSON
download
home_page
SummaryCollection of tools for cloud provisioning of Microchip IoT kits
upload_time2023-12-12 09:19:05
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords microchip avr pic avr-iot pic-iot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pykitcommander
pykitcommander manages interaction with Microchip development kits based on PKOB nano on-board debugger

![PyPI - Format](https://img.shields.io/pypi/format/pykitcommander)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pykitcommander)
![PyPI - License](https://img.shields.io/pypi/l/pykitcommander)

## Overview
pykitcommander is available:

* install using pip from pypi: https://pypi.org/project/pykitcommander
* browse source code on github: https://github.com/microchip-pic-avr-tools/pykitcommander
* read API documentation on github: https://microchip-pic-avr-tools.github.io/pykitcommander

## Background
In many situations interaction with peripheral hardware components on a development kit is done via a "bridge" application running on the MCU on that kit.  To achieve this, the bridge firmware must be programmed onto that MCU, and then communications over a given channel and protocol can logically link the host computer to the peripheral components.

pykitcommander manages some aspects of this interaction by:
- Containing a registry of application hex files for various applications on various kits
- Programming the application onto the kit
- Providing a most-probable serial-port connection string for that kit
- Providing an indication of what protocol format is in use on the application
- Supporting common protocol framing formats being used

## Usage
pykitcommander is intended to be used as a library.
Its primary consumers are:
- pytrustplatform (www.pypi.org/project/pytrustplatform)
- iotprovision (www.pypi.org/project/iotprovision)

Supported kits are:
- AVR-IoT WG and WA
- PIC-IoT WG and WA
- AVR-IoT Cellular Mini
- SAM-IoT WG
- SAM-IoT Wx V2
- CryptoAuth Trust Platform Development Kit

## Simple example
This example shows how pykitcommander can be used to read the serial number from an ECC608 device.  This device is connected to the MCU on the board (either PIC or AVR depending on the variant).  The MCU is connected to the host computer via a virtual serial port provided by the on-board debugger.

This example uses the 'setup_kit("iotprovision")' helper function to achieve this very simply.
```python
from pykitcommander.kitprotocols import setup_kit

# Request iotprovision protocol to be set up on a connected kit
info = setup_kit("iotprovision")

# Create a serial connection to communicate with the firmware
# Note: SerialCDC class wraps pyserial Serial class
from pyedbglib.serialport.serialcdc import SerialCDC
with SerialCDC(info['port'], info['protocol_baud'], timeout=10, stopbits=2) as serial_connection:
    # The firmware driver wraps this serial connection which enables a simple command-response transaction
    # This is defined in pykitcommander
    from pykitcommander.firmwareinterface import ProvisioningFirmwareDriver
    firmware_driver = ProvisioningFirmwareDriver(serial_connection)

    # Read out firmware version
    version = firmware_driver.firmware_command("MC+VERSION=FIRMWARE")

    # Send firmware command to turn LED on
    firmware_driver.firmware_command("MC+SETLED", ["conn","on"])

    # Send firmware command to read the ECC serial number
    ecc_serial_number = firmware_driver.firmware_command("MC+ECC+SERIAL")
    print("ECC serial number read out: '{}'".format(ecc_serial_number))

    # Send firmware command to turn LED off
    firmware_driver.firmware_command("MC+SETLED", ["conn","off"])
```

## DIY example
This example shows how pykitcommander can be used to read the serial number from an ECC608 device.  In this case, the firmware you use is your own, but complies to the same protocol as the standard provisioning firmware. The MCU is connected to the host computer via a virtual serial port provided by the on-board debugger.  In this example the serial port and baud rate are also specified explicitly.

```python

# Program firmware onto the kit
from pykitcommander.kitmanager import KitProgrammer

programmer = KitProgrammer()
programmer.program_application("my_firmware.hex")

# Create a serial connection to communicate with the firmware
# Note: SerialCDC class wraps pyserial Serial class
from pyedbglib.serialport.serialcdc import SerialCDC
with SerialCDC("COM3", 115200, timeout=10, stopbits=2) as serial_connection:
    # The firmware driver wraps this serial connection which enables a simple command-response transaction
    # This is defined in pykitcommander
    from pykitcommander.firmwareinterface import ProvisioningFirmwareDriver
    firmware_driver = ProvisioningFirmwareDriver(serial_connection)

    # Read out firmware version
    version = firmware_driver.firmware_command("MC+VERSION=FIRMWARE")

    # Send firmware command to turn LED on
    firmware_driver.firmware_command("MC+SETLED", ["conn","on"])

    # Send firmware command to read the ECC serial number
    ecc_serial_number = firmware_driver.firmware_command("MC+ECC+SERIAL")
    print("ECC serial number read out: '{}'".format(ecc_serial_number))

    # Send firmware command to turn LED off
    firmware_driver.firmware_command("MC+SETLED", ["conn","off"])
```

## Logging
This package uses the Python logging module for publishing log messages to library users.
A basic configuration can be used (see example below), but for best results a more thorough configuration is
recommended in order to control the verbosity of output from dependencies in the stack which also use logging.

```python
# pykitcommander uses the Python logging module
import logging
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.WARNING)
```

## Notes for Linux® systems
This package uses pyedbglib and other libraries for USB transport and some udev rules are required. For details see the pyedbglib package: https://pypi.org/project/pyedbglib
# Changelog

# [2.8] - December 2023

### Changed
- DSG-6666 Updated AVR-IoT provisioning firmware, AVR-IoT Cellular Mini provisioning firmware, AVR-IoT Cellular Mini AWS demo and PIC-IoT Azure demo.

### Added
- DSG-5883 Added support for SAM-IoT Wx

### Fixed
- DSG-6133 PEP-0440 compliance for pykitcommander

# [2.7] - October 2022

### Changed
- DSG-5451 Added metadata tag for Python 3.10
- DSG-5549 Removed metadata tag for Python 3.6
- DSG-5361 Updated firmware (v1.1.7) for AVR-IoT Cellular Mini provisioning
- DSG-5624 Updated pyedbglib dependency requirement for improved serial port detection

### Fixed
- DSG-5017 Fixed error in example code

## [2.6] - June 2022

### Added
- DSG-4393 Added link to github readme to github docs
- DSG-4445 Added support for CryptoAuth Trust Platform Development Kit (DM320118) provisioning firmware
- DSG-4496 Added support for AVR-IoT Cellular Mini (EV70N78A) provisioning firmware
- DSG-4604 Add SAM-IOT demo firmware for Azure and Google

## [2.3] - December 2021

### Added
- DSG-3304 Sphinx documentation
- DSG-2152 New kit protocols (v2)
- DSG-4086 Publication to GitHib + pypi

## [1.0.5.8] - December 2020
- First public release to PyPi

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pykitcommander",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "Microchip,AVR,PIC,AVR-IoT,PIC-IoT",
    "author": "",
    "author_email": "Microchip Technology <support@microchip.com>",
    "download_url": "",
    "platform": null,
    "description": "# pykitcommander\npykitcommander manages interaction with Microchip development kits based on PKOB nano on-board debugger\n\n![PyPI - Format](https://img.shields.io/pypi/format/pykitcommander)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pykitcommander)\n![PyPI - License](https://img.shields.io/pypi/l/pykitcommander)\n\n## Overview\npykitcommander is available:\n\n* install using pip from pypi: https://pypi.org/project/pykitcommander\n* browse source code on github: https://github.com/microchip-pic-avr-tools/pykitcommander\n* read API documentation on github: https://microchip-pic-avr-tools.github.io/pykitcommander\n\n## Background\nIn many situations interaction with peripheral hardware components on a development kit is done via a \"bridge\" application running on the MCU on that kit.  To achieve this, the bridge firmware must be programmed onto that MCU, and then communications over a given channel and protocol can logically link the host computer to the peripheral components.\n\npykitcommander manages some aspects of this interaction by:\n- Containing a registry of application hex files for various applications on various kits\n- Programming the application onto the kit\n- Providing a most-probable serial-port connection string for that kit\n- Providing an indication of what protocol format is in use on the application\n- Supporting common protocol framing formats being used\n\n## Usage\npykitcommander is intended to be used as a library.\nIts primary consumers are:\n- pytrustplatform (www.pypi.org/project/pytrustplatform)\n- iotprovision (www.pypi.org/project/iotprovision)\n\nSupported kits are:\n- AVR-IoT WG and WA\n- PIC-IoT WG and WA\n- AVR-IoT Cellular Mini\n- SAM-IoT WG\n- SAM-IoT Wx V2\n- CryptoAuth Trust Platform Development Kit\n\n## Simple example\nThis example shows how pykitcommander can be used to read the serial number from an ECC608 device.  This device is connected to the MCU on the board (either PIC or AVR depending on the variant).  The MCU is connected to the host computer via a virtual serial port provided by the on-board debugger.\n\nThis example uses the 'setup_kit(\"iotprovision\")' helper function to achieve this very simply.\n```python\nfrom pykitcommander.kitprotocols import setup_kit\n\n# Request iotprovision protocol to be set up on a connected kit\ninfo = setup_kit(\"iotprovision\")\n\n# Create a serial connection to communicate with the firmware\n# Note: SerialCDC class wraps pyserial Serial class\nfrom pyedbglib.serialport.serialcdc import SerialCDC\nwith SerialCDC(info['port'], info['protocol_baud'], timeout=10, stopbits=2) as serial_connection:\n    # The firmware driver wraps this serial connection which enables a simple command-response transaction\n    # This is defined in pykitcommander\n    from pykitcommander.firmwareinterface import ProvisioningFirmwareDriver\n    firmware_driver = ProvisioningFirmwareDriver(serial_connection)\n\n    # Read out firmware version\n    version = firmware_driver.firmware_command(\"MC+VERSION=FIRMWARE\")\n\n    # Send firmware command to turn LED on\n    firmware_driver.firmware_command(\"MC+SETLED\", [\"conn\",\"on\"])\n\n    # Send firmware command to read the ECC serial number\n    ecc_serial_number = firmware_driver.firmware_command(\"MC+ECC+SERIAL\")\n    print(\"ECC serial number read out: '{}'\".format(ecc_serial_number))\n\n    # Send firmware command to turn LED off\n    firmware_driver.firmware_command(\"MC+SETLED\", [\"conn\",\"off\"])\n```\n\n## DIY example\nThis example shows how pykitcommander can be used to read the serial number from an ECC608 device.  In this case, the firmware you use is your own, but complies to the same protocol as the standard provisioning firmware. The MCU is connected to the host computer via a virtual serial port provided by the on-board debugger.  In this example the serial port and baud rate are also specified explicitly.\n\n```python\n\n# Program firmware onto the kit\nfrom pykitcommander.kitmanager import KitProgrammer\n\nprogrammer = KitProgrammer()\nprogrammer.program_application(\"my_firmware.hex\")\n\n# Create a serial connection to communicate with the firmware\n# Note: SerialCDC class wraps pyserial Serial class\nfrom pyedbglib.serialport.serialcdc import SerialCDC\nwith SerialCDC(\"COM3\", 115200, timeout=10, stopbits=2) as serial_connection:\n    # The firmware driver wraps this serial connection which enables a simple command-response transaction\n    # This is defined in pykitcommander\n    from pykitcommander.firmwareinterface import ProvisioningFirmwareDriver\n    firmware_driver = ProvisioningFirmwareDriver(serial_connection)\n\n    # Read out firmware version\n    version = firmware_driver.firmware_command(\"MC+VERSION=FIRMWARE\")\n\n    # Send firmware command to turn LED on\n    firmware_driver.firmware_command(\"MC+SETLED\", [\"conn\",\"on\"])\n\n    # Send firmware command to read the ECC serial number\n    ecc_serial_number = firmware_driver.firmware_command(\"MC+ECC+SERIAL\")\n    print(\"ECC serial number read out: '{}'\".format(ecc_serial_number))\n\n    # Send firmware command to turn LED off\n    firmware_driver.firmware_command(\"MC+SETLED\", [\"conn\",\"off\"])\n```\n\n## Logging\nThis package uses the Python logging module for publishing log messages to library users.\nA basic configuration can be used (see example below), but for best results a more thorough configuration is\nrecommended in order to control the verbosity of output from dependencies in the stack which also use logging.\n\n```python\n# pykitcommander uses the Python logging module\nimport logging\nlogging.basicConfig(format=\"%(levelname)s: %(message)s\", level=logging.WARNING)\n```\n\n## Notes for Linux\u00ae systems\nThis package uses pyedbglib and other libraries for USB transport and some udev rules are required. For details see the pyedbglib package: https://pypi.org/project/pyedbglib\n# Changelog\n\n# [2.8] - December 2023\n\n### Changed\n- DSG-6666 Updated AVR-IoT provisioning firmware, AVR-IoT Cellular Mini provisioning firmware, AVR-IoT Cellular Mini AWS demo and PIC-IoT Azure demo.\n\n### Added\n- DSG-5883 Added support for SAM-IoT Wx\n\n### Fixed\n- DSG-6133 PEP-0440 compliance for pykitcommander\n\n# [2.7] - October 2022\n\n### Changed\n- DSG-5451 Added metadata tag for Python 3.10\n- DSG-5549 Removed metadata tag for Python 3.6\n- DSG-5361 Updated firmware (v1.1.7) for AVR-IoT Cellular Mini provisioning\n- DSG-5624 Updated pyedbglib dependency requirement for improved serial port detection\n\n### Fixed\n- DSG-5017 Fixed error in example code\n\n## [2.6] - June 2022\n\n### Added\n- DSG-4393 Added link to github readme to github docs\n- DSG-4445 Added support for CryptoAuth Trust Platform Development Kit (DM320118) provisioning firmware\n- DSG-4496 Added support for AVR-IoT Cellular Mini (EV70N78A) provisioning firmware\n- DSG-4604 Add SAM-IOT demo firmware for Azure and Google\n\n## [2.3] - December 2021\n\n### Added\n- DSG-3304 Sphinx documentation\n- DSG-2152 New kit protocols (v2)\n- DSG-4086 Publication to GitHib + pypi\n\n## [1.0.5.8] - December 2020\n- First public release to PyPi\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Collection of tools for cloud provisioning of Microchip IoT kits",
    "version": "2.8.3.18",
    "project_urls": {
        "Homepage": "https://github.com/microchip-pic-avr-tools/pykitcommander"
    },
    "split_keywords": [
        "microchip",
        "avr",
        "pic",
        "avr-iot",
        "pic-iot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2811691c7c50dbb6aca92cd40ac92eb8175d3eeb41c8cdea7ca8ede7823edca8",
                "md5": "ba1c40de2cc90c9df5d0aa7d15105b17",
                "sha256": "e887ee01e7eabf50a42c176708c1ff26097dd4263da5dc6a70cf5e7f282bc773"
            },
            "downloads": -1,
            "filename": "pykitcommander-2.8.3.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ba1c40de2cc90c9df5d0aa7d15105b17",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1628384,
            "upload_time": "2023-12-12T09:19:05",
            "upload_time_iso_8601": "2023-12-12T09:19:05.830600Z",
            "url": "https://files.pythonhosted.org/packages/28/11/691c7c50dbb6aca92cd40ac92eb8175d3eeb41c8cdea7ca8ede7823edca8/pykitcommander-2.8.3.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-12 09:19:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "microchip-pic-avr-tools",
    "github_project": "pykitcommander",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pykitcommander"
}
        
Elapsed time: 0.34327s