pyedbglib documentation

Python EDBG protocol communication library

pyedbglib is a low-level protocol library for communicating with Microchip CMSIS-DAP based debuggers.


pyedbglib is available:

pyedbglib uses hidapi package with a USB-level driver such as libusb.

Library usage

The protocol library has no application usage on its own, but provides USB-protocol-level tool drivers to applications such as pymcuprog. In general a two-stage stack implementation is required for using pyedbglib:

  1. Create transport HID layer

  2. Create protocol implementation using this transport layer

All protocols implemented in the library generally take the transport layer as a parameter to their constructors.

To use pyedbglib as a library for applications, the following usage patterns can be used:

# Import and instantiate transport object:
from pyedbglib.hidtransport.hidtransportfactory import hid_transport
transport = hid_transport()

# Connect to any PKOB nano (nEDBG) tool.  Serial number and product are optional, but must
# be provided if more than one matching unit is connected:
status = transport.connect(serial_number="", product="nedbg")

# Example of application using housekeeping protocol to read out the target voltage:
from pyedbglib.protocols.housekeepingprotocol import Jtagice3HousekeepingProtocol
housekeeper = Jtagice3HousekeepingProtocol(transport)
voltage = housekeeper.get_le16(Jtagice3HousekeepingProtocol.HOUSEKEEPING_CONTEXT_ANALOG,
voltage = voltage / 1000.0
print ("Target is running at {0:.02f}V".format(voltage))


Indices and tables