A protocol driver for a generic development kit command handler interface
Project description
pykitcommander
pykitcommander manages interaction with Microchip development kits based on PKOB nano on-board debugger
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 all aspects of this interaction.
Usage
pykitcommander is intended to be used as a library. Its primary consumers are:
- pytrustplatform (www.pypi.org/project/pytrustplatform)
- iotprovision
Supported kits are:
- AVR-IOT (all variants)
- PIC-IOT (all variants)
Dependencies
This package uses pyedbglib for USB communications. For more information see: https://pypi.org/project/pyedbglib/
Short 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 'iotprovision' helper function to achieve this very simply.
from pykitcommander.firmwareinterface import KitSerialConnection
from pykitcommander.kitprotocols import get_iot_provision_protocol
# Request iotprovision protocol to be set up
protocol, port = get_iot_provision_protocol()
# Connect to the protocol
with KitSerialConnection(protocol, port):
# Read the serial number from the ECC
ecc_serial_number = protocol.read_ecc_serialnumber()
print("ECC serial number read out as '{}'".format(ecc_serial_number))
Long 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 does not use the 'iotprovision' helper function.
from pykitcommander.kitmanager import KitProgrammer
from pykitcommander.kitmanager import KitApplicationFirmwareProvider
from pykitcommander.firmwareinterface import KitSerialConnection
# Connect to the kit programmer/debugger
programmer = KitProgrammer()
# Look up available applications for this kit
applications = KitApplicationFirmwareProvider(kitname=programmer.kit_info['kit_name'])
# Request iotprovision application
application = applications.locate_firmware(firmware_identifier="iotprovision")
# Program the application using bundled firmware
programmer.program_application(application['bundled_firmware'])
# Create the protocol object for this application
protocol = application['protocol_driver']()
# Connect to the protocol
with KitSerialConnection(protocol, port):
# Read the serial number from the ECC
ecc_serial_number = protocol.read_ecc_serialnumber()
print("ECC serial number read out as '{}'".format(ecc_serial_number))
Project details
NoneDownload files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for pykitcommander-1.0.5.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98bde222098dbea17dd87d678eb9ec072bd0bf863bacb1a28cd4b842f8f5fba7 |
|
MD5 | e11a4fd445fd4eb680f2de0bec1cca28 |
|
BLAKE2b-256 | 4d1e2081c95138e24112aa0e8d6b07b8c3e2b28cfa857995473031ad3f902705 |