Skip to main content

A protocol driver for a generic development kit command handler interface

None

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:

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

None

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pykitcommander-1.0.5.8-py3-none-any.whl (543.7 kB view hashes)

Uploaded Python 3

Supported by

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