### start_session() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Starts a session with the debugger (sign-on). ```APIDOC ### start_session() Starts a new communication session with the connected debugger. ``` -------------------------------- ### selftest_timeout_ms(timeout_ms, counter_value=0) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Starts a timer with the given timeout value and returns when the timer has expired. ```APIDOC ## selftest_timeout_ms(timeout_ms, counter_value=0) ### Description Test timer timeout. This function starts a timer with the given timeout value and returns when the timer has expired. Alternatively the timer counter value can be overridden by providing a counter_value > 0. ### Parameters - **timeout_ms** (int) - Required - Timeout value in milliseconds. - **counter_value** (int) - Optional - Value to be written to timer counter register before timer is started. ``` -------------------------------- ### Initialize Transport and Housekeeping Protocol Source: https://microchip-pic-avr-tools.github.io/pyedbglib/index.html Demonstrates connecting to a PKOB nano tool and using the housekeeping protocol to read target voltage. ```python # 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) housekeeper.start_session() voltage = housekeeper.get_le16(Jtagice3HousekeepingProtocol.HOUSEKEEPING_CONTEXT_ANALOG, Jtagice3HousekeepingProtocol.HOUSEKEEPING_ANALOG_VTREF) voltage = voltage / 1000.0 housekeeper.end_session() print ("Target is running at {0:.02f}V".format(voltage)) ``` -------------------------------- ### Library Usage Pattern Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.html Demonstrates how to instantiate a HID transport layer, connect to a debugger, and use a protocol class (e.g., Jtagice3HousekeepingProtocol) to interact with the hardware. ```APIDOC ## Library Usage Pattern ### Description This pattern shows the standard workflow for using pyedbglib: initializing the HID transport, connecting to a specific debugger, and performing operations via a protocol handler. ### Usage Example ```python # Import and instantiate transport object: from pyedbglib.hidtransport.hidtransportfactory import hid_transport transport = hid_transport() # Connect to a tool (e.g., PKOB nano/nEDBG) status = transport.connect(serial_number="", product="nedbg") # Example using housekeeping protocol to read target voltage from pyedbglib.protocols.housekeepingprotocol import Jtagice3HousekeepingProtocol housekeeper = Jtagice3HousekeepingProtocol(transport) housekeeper.start_session() voltage = housekeeper.get_le16(Jtagice3HousekeepingProtocol.HOUSEKEEPING_CONTEXT_ANALOG, Jtagice3HousekeepingProtocol.HOUSEKEEPING_ANALOG_VTREF) voltage = voltage / 1000.0 housekeeper.end_session() print ("Target is running at {0:.02f}V".format(voltage)) ``` ``` -------------------------------- ### step() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Executes a single-step on the core. ```APIDOC ## step() ### Description Executes a single-step on the core. A BREAK event will be generated when it has completed. ``` -------------------------------- ### DapCommand.get_all_info Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Fetches a set of useful information from the DAP. ```APIDOC ## DapCommand.get_all_info() ### Description Fetches a set of useful information from the DAP. ### Returns - **dictionary** - A dictionary of parameters containing DAP information. ``` -------------------------------- ### run() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Resumes execution of the target core. ```APIDOC ## run() ### Description Resumes core execution. ``` -------------------------------- ### enter_upgrade_mode(key=829586448) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Puts the debugger into firmware upgrade mode. ```APIDOC ### enter_upgrade_mode(key=829586448) Transitions the debugger into firmware upgrade mode. #### Parameters - **key** (int) - Optional - The upgrade key required to authorize the mode change. ``` -------------------------------- ### list_supported_commands() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Uses the query interface to list all supported commands. ```APIDOC ### list_supported_commands() Queries the debugger to retrieve a list of all commands supported by the current protocol implementation. ``` -------------------------------- ### tool_shortname_to_product_string_name(shortname) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Maps common tool shortnames to their corresponding USB product string names. ```APIDOC ## tool_shortname_to_product_string_name(shortname) ### Description Converts a tool shortname (e.g., 'atmelice') to the string used in USB product descriptors. If the name is already a valid product string or unknown, it returns the input unchanged. ### Parameters - **shortname** (string) - Required - The shortname used by atbackend. ### Returns - **string** - The product string name. ``` -------------------------------- ### Create a HID transport connection Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Use the hid_transport factory to initialize a connection to a debugger, such as the nEDBG, before passing it to a protocol object. ```python from pyedbglib.hidtransport.hidtransportfactory import hid_transport transport = hid_transport() connect_status = False try: connect_status = transport.connect(serial_number='', product='nedbg') except IOError as error: print("Unable to connect to USB device ({})".format(error)) if not connect_status: print("Unable to connect to USB device") housekeeper = housekeepingprotocol.Jtagice3HousekeepingProtocol(transport) ``` -------------------------------- ### activate_physical(use_reset=False) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Activates the physical interface for communication with the target. ```APIDOC ## activate_physical(use_reset=False) ### Description Activates the physical interface. ### Parameters - **use_reset** (bool) - Optional - Whether to trigger a reset during activation. ``` -------------------------------- ### dap_connect() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Connects to the DAP interface. ```APIDOC ## dap_connect() ### Description Connects to the DAP. ``` -------------------------------- ### SerialPortMap Methods Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.serialport.html Utility methods for mapping between virtual serial ports and their parent USB HID devices. ```APIDOC ## SerialPortMap.find_hid_tool(port) Finds the HID tool object associated with a given virtual serial port name. ## SerialPortMap.find_matching_tools_ports(serial_endswith) Finds tools and ports matching a partial serial number. Returns a list of dictionaries containing tool and port information. ## SerialPortMap.find_serial_number(port) Retrieves the HID tool serial number associated with a specific virtual serial port name. ## SerialPortMap.find_serial_port(serial_number) Finds the virtual serial port name based on an exact match of the tool's serial number. ``` -------------------------------- ### get_config(offset, byte_count) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads configuration data from the target at a specific offset. ```APIDOC ## get_config(offset, byte_count) ### Description Low level function to read configuration data from target. ### Parameters - **offset** (int) - Required - Offset to read from - **byte_count** (int) - Required - Number of bytes to read ``` -------------------------------- ### Gen4Controller.execute(script) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.primitive.html Executes a binary script byte-code atomically on the GEN4 script engine. ```APIDOC ## Gen4Controller.execute(script) ### Description Performs atomic execution of a provided binary script byte-code. ### Parameters - **script** (array) - Required - Binary script byte-code to execute. ### Returns - **results** (any) - Results of the script execution. ### Throws - **Gen4Exception** - If the script fails to execute. ``` -------------------------------- ### DapCommand.info Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Fetch specific DAP information given by dap_id. ```APIDOC ## DapCommand.info(dap_id) ### Description Fetch specific DAP information given by dap_id. ### Parameters - **dap_id** (int) - Required - Code for different DAP_ID_* fields. ### Returns - **bytearray** - The requested DAP information. ``` -------------------------------- ### SerialCDC.open() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.serialport.html Opens the serial port with a configurable timeout, retrying until the CDC device is accessible. ```APIDOC ## SerialCDC.open() ### Description Overrides the parent pyserial open() method to include a timeout mechanism, allowing for retries when waiting for a CDC serial port device to become available. ### Parameters - **open_timeout** (int) - Optional - Number of seconds to wait for the port to become accessible (default: 30). ``` -------------------------------- ### set_config(offset, data) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Performs block programming of configuration data. ```APIDOC ## set_config(offset, data) ### Description Block programming of configuration data. ### Parameters - **offset** (int) - Required - Offset to start programming - **data** (bytes) - Required - Configuration data to program ``` -------------------------------- ### Binary Packing and Unpacking Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.util.html Functions for packing and unpacking integers into bytearrays using big-endian or little-endian formats. ```APIDOC ## pack_be16(value) ## pack_be24(value) ## pack_be32(value) ## pack_le16(value) ## pack_le24(value) ## pack_le32(value) ### Description These functions pack an integer value into a bytearray of the specified size and endianness. ### Parameters - **value** (int) - Required - The input integer to pack. ### Returns - (bytearray) - The packed bytearray representation. ## unpack_be16(data) ## unpack_be24(data) ## unpack_be32(data) ## unpack_le16(data) ## unpack_le24(data) ## unpack_le32(data) ### Description These functions unpack a bytearray into an integer value based on the specified size and endianness. ### Parameters - **data** (bytearray) - Required - The bytearray representation of the integer. ### Returns - (int) - The unpacked integer value. ``` -------------------------------- ### hid_transport(library='hidapi') Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Creates and returns an instance of the HID transport layer object. Currently, only 'hidapi' is supported. ```APIDOC ## hid_transport(library='hidapi') ### Description Dispatches a transport layer for the OS. This object is used to connect to a debugger tool. ### Parameters - **library** (string) - Optional - Transport library to use (default: 'hidapi'). ### Returns - **object** - Instance of the transport layer (CyHidApiTransport). ### Raises - **PyedbglibNotSupportedError** - If the specified library is not supported. ``` -------------------------------- ### avr_command_response(command) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Sends an AVR command and receives a response. ```APIDOC ## avr_command_response(command) ### Description Sends an AVR command and receives a response. ### Parameters - **command** (bytes) - Required - Command bytes to send ### Response - **response** (bytes) - Response bytes received ``` -------------------------------- ### PrimitiveController.execute(primitive_blocks) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.primitive.html Executes primitive blocks atomically on the primitive sequence executer. ```APIDOC ## PrimitiveController.execute(primitive_blocks) ### Description Performs atomic execution of primitive blocks. ### Parameters - **primitive_blocks** (array) - Required - Blocks to execute. ### Returns - **results** (any) - Results of the execution. ``` -------------------------------- ### dap_led(index, state) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Operates the LED on the target device. ```APIDOC ## dap_led(index, state) ### Description Operates the LED. ### Parameters - **index** (int) - Required - Which led - **state** (int) - Required - What to do with it ``` -------------------------------- ### CmsisDapSamDebugger.dap_reset_ext Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Performs a hardware reset on SAM devices with optional reset extension. ```APIDOC ## dap_reset_ext(extend=False) ### Description Resets the target using the hardware. Some SAM devices require a reset extension to prevent the device from running after reset and overriding its SWD IO. ### Parameters - **extend** (bool) - Optional - If True, holds SW_CLK low while releasing /RESET. ``` -------------------------------- ### write_device_data(data) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Write device info into the device context. ```APIDOC ## write_device_data(data) ### Description Write device info into the device context. ### Parameters - **data** (any) - Required - Device data content ``` -------------------------------- ### dap_info() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Retrieves information about the DAP. ```APIDOC ## dap_info() ### Description Collects the dap info. ``` -------------------------------- ### reset() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Resets the target core and holds it in the reset state. ```APIDOC ## reset() ### Description Resets the core and holds it in reset. ``` -------------------------------- ### get_ati_header Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Generates an ATI header for an ATI consumer. ```APIDOC ## get_ati_header(handler, handler_variant=0) ### Description Generates an ATI header for an ATI consumer. ### Parameters - **handler** (int) - Required - Which handler to invoke - **handler_variant** (int) - Optional - Variant (flags) of that handler ### Returns - **bytearray** - ATI header frame ``` -------------------------------- ### attach(do_break=False) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Attaches the debugger to the target device. ```APIDOC ## attach(do_break=False) ### Description Attaches the debugger to the target. ### Parameters - **do_break** (bool) - Optional - Whether to break execution upon attaching. ``` -------------------------------- ### stop() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Requests a core halt. ```APIDOC ## stop() ### Description Requests a core halt. A BREAK event will be generated when it has successfully stopped. ``` -------------------------------- ### DataChopper Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.util.html Utility class for preparing data for USB transport by splitting it into smaller chunks. ```APIDOC ## DataChopper(size, padding=None) ### Description Initializes a DataChopper instance to prepare data for USB transfers. ### Parameters - **size** (int) - Required - The chunk size for data. - **padding** (any) - Optional - Padding value for lists. ## DataChopper.chopper(data) ### Description Chops a large list of data into smaller chunks based on the configured package size. ### Parameters - **data** (list) - Required - The data to be chopped. ### Returns - (list) - A list of chopped lists. ## DataChopper.fix_data_type(data) ### Description Validates and formats incoming data for transmission. ### Parameters - **data** (any) - Required - The input data to validate. ### Returns - (list) - A list of valid data ready to send. ``` -------------------------------- ### detect_hid_packet_size(product_id, serial_number) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Detects the HID packet size on Linux and Mac by inspecting the USB descriptor. ```APIDOC ## detect_hid_packet_size(product_id, serial_number) ### Description Uses pyUSB to determine the configuration in use by inspecting the USB descriptor. ### Parameters - **product_id** (int/hex) - Required - USB PID to look for. - **serial_number** (string) - Required - USB serial number to match. ### Returns - **int** - Detected report size, or 0 if no match is found. ``` -------------------------------- ### software_breakpoint_set(address) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Insert a software breakpoint at the given address. ```APIDOC ## software_breakpoint_set(address) ### Description Insert a software breakpoint at the given address. ### Parameters - **address** (any) - Required - Breakpoint address ``` -------------------------------- ### read_version_info() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads version info from the debugger. ```APIDOC ### read_version_info() Retrieves version information from the connected debugger hardware. ``` -------------------------------- ### check_access(port) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.serialport.html Checks if the current user has sufficient permissions to access the specified virtual serial port. ```APIDOC ## check_access(port) ### Description Verifies if the user has access to the kit's virtual serial port. This is particularly useful on Linux systems where access may be restricted by group membership (e.g., 'dialout'). ### Parameters - **port** (str) - Required - The name of the serial port to check. ### Returns - **boolean** - True if access is allowed, False otherwise. ``` -------------------------------- ### MpLabTransport.hid_read() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.mplabtransport.html Waits for and receives a packet over the HID interface. ```APIDOC ## MpLabTransport.hid_read() ### Description Blocks until a packet is received over the HID interface. ``` -------------------------------- ### memory_write(memtype, address, data) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Writes data to the target memory. ```APIDOC ## memory_write(memtype, address, data) ### Description Write memory to target. ### Parameters - **memtype** (int) - Required - The memory type or region to access. - **address** (int) - Required - The start address. - **data** (bytearray) - Required - The data to write. ``` -------------------------------- ### memory_read(memtype, address, num_bytes) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads data from the target memory. ```APIDOC ## memory_read(memtype, address, num_bytes) ### Description Read memory from the target. ### Parameters - **memtype** (int) - Required - The memory type or section to read. - **address** (int) - Required - The start address. - **num_bytes** (int) - Required - The number of bytes to read. ### Returns - **data** (bytearray) - The memory content read from the target. ``` -------------------------------- ### HidTransportBase Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html The HidTransportBase class serves as the base for all HID transport mechanisms, providing common functionality for connecting to debuggers and querying device information. ```APIDOC ## HidTransportBase ### Methods - **connect(serial_number=None, product=None)**: Connects to a debugger. Returns True if successful, False otherwise. - **disconnect()**: Releases the HID connection. - **get_matching_tools(serial_number_substring='', product=None)**: Returns a list of tools matching the provided serial number substring and product type. - **get_report_size()**: Returns the packet size in bytes. ``` -------------------------------- ### hid_transport Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Factory function to instantiate a HID transport object. ```APIDOC ## hid_transport() ### Description Factory function used to create and return an appropriate HID transport instance. ``` -------------------------------- ### HidTool Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html The HidTool class represents a CMSIS-DAP debugger, holding transport and DAP properties used for selecting specific debuggers. ```APIDOC ## HidTool ### Methods - **set_packet_size(packet_size)**: Sets the packet size in bytes. - **set_product_string(product_string)**: Sets the product name string for the tool. ``` -------------------------------- ### end_session(reset_tool=False) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Ends a session with the debugger (sign-off). ```APIDOC ### end_session(reset_tool=False) Ends the current session with the debugger. #### Parameters - **reset_tool** (bool) - Optional - If True, resets the hardware upon session termination. ``` -------------------------------- ### software_breakpoint_clear_all() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Clears all software breakpoints. ```APIDOC ## software_breakpoint_clear_all() ### Description Clears all software breakpoints. ``` -------------------------------- ### HidTransportBase Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Base class for HID transport implementations providing common connection and discovery methods. ```APIDOC ## HidTransportBase ### Methods - **connect()**: Connects to the transport interface. - **detect_devices()**: Detects available tools. - **disconnect()**: Disconnects from the transport interface. - **get_matching_tools()**: Returns a list of tools matching the transport. - **get_report_size()**: Retrieves the HID report size. - **hid_connect()**: Connects to the HID layer. - **hid_disconnect()**: Disconnects from the HID layer. - **hid_info()**: Returns information about the HID transport. ``` -------------------------------- ### get_default_report_size(pid) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Retrieves the default endpoint report size for a given product ID. ```APIDOC ## get_default_report_size(pid) ### Description Returns the default EP report size based on known product IDs. ### Parameters - **pid** (int/hex) - Required - Product ID. ### Returns - **int** - Packet size. ``` -------------------------------- ### adjust_hid_packet_size(transport, device) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Performs active HID packet size detection and adjustment for Windows systems after a connection is established. ```APIDOC ## adjust_hid_packet_size(transport, device) ### Description Detects and adjusts the HID report size on Windows by querying the tool for its frame size after connection. ### Parameters - **transport** (object) - Required - An already connected HID transport object. - **device** (object) - Required - The device currently connected. ``` -------------------------------- ### MpLabTransport.hid_transfer(packet) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.mplabtransport.html Sends a packet and waits for a response. ```APIDOC ## MpLabTransport.hid_transfer(packet) ### Description Sends a specified packet to the HID interface and waits to receive a response. ### Parameters - **packet** (bytes) - The data packet to send. ``` -------------------------------- ### poll_events() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Polling for events from AVRs. ```APIDOC ## poll_events() ### Description Polling for events from AVRs. ### Response - **event** (bytearray|None) - A received event, or None ``` -------------------------------- ### CyHidApiTransport Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html Interface for HID communication using the CyHidApi backend. ```APIDOC ## CyHidApiTransport ### Methods - **detect_devices()**: Scans for available HID devices. - **hid_connect()**: Establishes a connection to the HID device. - **hid_disconnect()**: Closes the connection to the HID device. - **hid_info()**: Retrieves information about the connected HID device. - **hid_read()**: Reads data from the HID device. - **hid_transfer()**: Performs a data transfer operation. - **hid_write()**: Writes data to the HID device. ``` -------------------------------- ### MpLabTransport.hid_write(packet) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.mplabtransport.html Sends a packet to the HID interface without waiting for a response. ```APIDOC ## MpLabTransport.hid_write(packet) ### Description Sends a packet to the HID interface. This operation does not wait for a response. ### Parameters - **packet** (bytes) - The data packet to send. ``` -------------------------------- ### EdbgProtocol.program_id_chip Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Program the connected ID device located at the id_number with data. ```APIDOC ## EdbgProtocol.program_id_chip(id_number, data) ### Description Program the connected ID device located at the id_number with data. ### Parameters - **id_number** (int) - Required - Extension header ID number (Range 1 - 16). - **data** (bytearray) - Required - A 64-byte data array to be programmed. ### Returns - **int** - Response status from the programming. ``` -------------------------------- ### PrimitiveControllerCommand.add_parameter(param_id, value, flags=0) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.primitive.html Adds a parameter to a Primitive command object. ```APIDOC ## PrimitiveControllerCommand.add_parameter(param_id, value, flags=0) ### Description Adds a parameter to the command envelope. ### Parameters - **param_id** (int) - Required - Parameter identifier. - **value** (any) - Required - Parameter value. - **flags** (int) - Optional - Flags for the parameter. ``` -------------------------------- ### CyHidApiTransport Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.hidtransport.html The CyHidApiTransport class implements HID transport methods using Cython and Hidapi. It provides methods for device detection, connection management, and data transfer. ```APIDOC ## CyHidApiTransport ### Methods - **detect_devices()**: Detects connected CMSIS-DAP devices and returns the count. - **hid_connect(device)**: Establishes a HID connection to the specified debugger device. - **hid_disconnect()**: Disconnects from the HID device. - **hid_info()**: Retrieves USB descriptor information. - **hid_read()**: Reads data from the HID device. - **hid_transfer(data_send)**: Sends data to the HID device and returns the response. - **hid_write(data_send)**: Sends data to the HID device and returns the number of bytes sent. ``` -------------------------------- ### CmsisDapDebugger.write_block Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Writes a block of data to the device memory bus. ```APIDOC ## write_block(address, data) ### Description Writes a block of data to the device memory bus. ### Parameters - **address** (int) - Required - The byte address to write to. - **data** (bytes) - Required - The data to write. ``` -------------------------------- ### CmsisDapDebugger.dap_read_idcode Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads the IDCODE from the SWD DP. ```APIDOC ## dap_read_idcode() ### Description Reads the IDCODE from the SWD DP. ``` -------------------------------- ### Gen4ControllerCommand.add_parameter(value_array) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.primitive.html Adds a parameter to a Gen4 command object. ```APIDOC ## Gen4ControllerCommand.add_parameter(value_array) ### Description Adds a parameter to the command envelope. ### Parameters - **value_array** (array) - Required - The parameter value to add. ``` -------------------------------- ### CmsisDapDebugger.dap_read_reg Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads a DAP AP/DP register. ```APIDOC ## dap_read_reg(reg) ### Description Reads a DAP AP/DP register. ### Parameters - **reg** (int) - Required - The register to read. ### Errors - **PyedbglibError** - Raised if the read fails. ``` -------------------------------- ### bytelist_to_hex_string Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.util.html Converts a list of bytes into a formatted hexadecimal string. ```APIDOC ## bytelist_to_hex_string(bytelist) ### Description Converts a list of byte values into a string representation where each byte is formatted as 0xXX. ### Parameters - **bytelist** (list) - Required - A list of byte values. ### Returns - (string) - The formatted hex string. ``` -------------------------------- ### set_interface(interface) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Sets the function field in the physical context. ```APIDOC ## set_interface(interface) ### Description Sets the function field in the physical context. ### Parameters - **interface** (any) - Required - Physical interface setting ``` -------------------------------- ### selftest_delay_us(delay_us) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Issues a delay of the specified number of microseconds. ```APIDOC ## selftest_delay_us(delay_us) ### Description Issue a delay of delay_us microseconds. ### Parameters - **delay_us** (int) - Required - Delay value in microseconds. Max is 4294967295. ``` -------------------------------- ### CmsisDapDebugger.read_block Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads a block of data from the device memory bus. ```APIDOC ## read_block(address, numbytes) ### Description Reads a block from the device memory bus. ### Parameters - **address** (int) - Required - The byte address to start reading from. - **numbytes** (int) - Required - The number of bytes to read. ### Errors - **PyedbglibError** - Raised if the transfer fails. ``` -------------------------------- ### software_breakpoint_clear(address) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Removes a software breakpoint from the given address. ```APIDOC ## software_breakpoint_clear(address) ### Description Removes a software breakpoint from the given address. ### Parameters - **address** (any) - Required - Breakpoint address ``` -------------------------------- ### selftest_delay_ms(delay_ms) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Issues a delay of the specified number of milliseconds. ```APIDOC ## selftest_delay_ms(delay_ms) ### Description Issue a delay of delay_ms milliseconds. ### Parameters - **delay_ms** (int) - Required - Delay value in milliseconds. Max is 65535. ``` -------------------------------- ### CmsisDapDebugger.dap_write_reg Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Writes a value to a DAP AP/DP register. ```APIDOC ## dap_write_reg(reg, value) ### Description Writes a value to a DAP AP/DP register. ### Parameters - **reg** (int) - Required - The register to write. - **value** (int) - Required - The value to write. ### Errors - **PyedbglibError** - Raised if the write fails. ``` -------------------------------- ### set_variant(variant) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Sets the variant field in the config context. ```APIDOC ## set_variant(variant) ### Description Sets the variant field in the config context. ### Parameters - **variant** (any) - Required - Type of device ``` -------------------------------- ### MpLabTransport.get_report_size() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.mplabtransport.html Retrieves the HID report size currently in use, typically 64 bytes or 512 bytes. ```APIDOC ## MpLabTransport.get_report_size() ### Description Returns the HID report size as reported through the HID interface. ### Returns - **size** (int) - The report size in bytes. ``` -------------------------------- ### selftest_delay_s(delay_s) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Issues a delay of the specified number of seconds. ```APIDOC ## selftest_delay_s(delay_s) ### Description Issue a delay of delay_s seconds. ### Parameters - **delay_s** (int) - Required - Delay value in seconds. Max is 65. ``` -------------------------------- ### AsynchronousTransportInterface.write_buffer Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Writes data to a specified buffer, handling data chopping to suit USB endpoint size. ```APIDOC ## write_buffer(buffer_id, data, buffer_type=0) ### Description Write data to a buffer. Will handle chopping of data to suit USB endpoint size. ### Parameters - **buffer_id** (int) - Required - ID of buffer to write data to - **data** (bytearray) - Required - Data bytes to be written - **buffer_type** (int) - Optional - ATI_CTRL_TYPE_DATA, ATI_CTRL_TYPE_METADATA, ATI_CTRL_TYPE_CMDRSP or ATI_CTRL_TYPE_SYS ``` -------------------------------- ### AsynchronousTransportInterface.read_buffer Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads data from a specified buffer, handling data chopping to suit USB endpoint size. ```APIDOC ## read_buffer(buffer_id, num_bytes=None, buffer_type=0) ### Description Reads data from a buffer. Will handle chopping of data reads to suit USB endpoint size. ### Parameters - **buffer_id** (int) - Required - ID of buffer to read from - **num_bytes** (int) - Optional - Number of bytes to read from the buffer - **buffer_type** (int) - Optional - ATI_CTRL_TYPE_DATA, ATI_CTRL_TYPE_METADATA, ATI_CTRL_TYPE_CMDRSP or ATI_CTRL_TYPE_SYS ### Returns - **bytearray** - Data bytes read from the buffer ``` -------------------------------- ### dap_disconnect() Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Disconnects from the DAP interface. ```APIDOC ## dap_disconnect() ### Description Disconnects from the DAP. ``` -------------------------------- ### EdbgProtocol.read_id_chip Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Reads the ID information from the ID chip connected at id_number. ```APIDOC ## EdbgProtocol.read_id_chip(id_number) ### Description Reads the ID information from the ID chip connected at id_number. ### Parameters - **id_number** (int) - Required - Extension header ID number (Range 1 - 16). ### Returns - **bytearray** - A 64-byte data array. ``` -------------------------------- ### selftest_timer_expired(timer_id) Source: https://microchip-pic-avr-tools.github.io/pyedbglib/pyedbglib.protocols.html Checks if a specific timer has expired. ```APIDOC ## selftest_timer_expired(timer_id) ### Description Check if a timer has expired. ### Parameters - **timer_id** (int) - Required - ID of timer to check. ### Returns - **bool** - True if timer has expired, False if not. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.