Pycmsisdapswitcher Utility
Last modified by Microchip on 2025/11/03 15:14
What is Pycmsisdapswitcher?
The pycmsisdapswitcher is a command-line Python® standalone package and library with two functionalities:
- To recover the bootloader firmware and the application firmware on a Microchip programmer/debugger or a Microchip development board in recovery mode
- To switch the application firmware on a Microchip programmer/debugger or a Microchip development board between the Microchip proprietary implementation and the Arm® CMSIS-DAP v2 compliant implementation
Refer to PyPi for more information.
List of Supported Targets
Recover
- MPLAB® ICD 5, ICD 4, ICE 4, PICkit™ 5, PICkit 4, PICkit Basic, and Snap programmer/debugger tools
- Microchip boards with MPLAB PICKit On-Board 4 (PKOB4) debugger
Switch
- MPLAB PICkit™ 4
- MPLAB PICkit 5
- MPLAB PICkit Basic
- MPLAB SNAP
- MPLAB PKOB4
- PIC32CXMTC Curiosity Ultra
- PIC32CZ CA80 Curiosity Ultra
- PIC32CZ CA90 Curiosity Ultra
- PIC32CK GC01 Curiosity Ultra
- PIC32CK SG01 Curiosity Ultra
- PIC32CK1012SG01 Curiosity Ultra
- PIC32CX SG41 Curiosity Ultra
- PIC32CX SG61 Curiosity Ultra
- PIC32CZ CA70 Curiosity Ultra
- SAMRH707 Evaluation Kit
- SAMRH71 TFBGA Evaluation Kit
Limitations
Only one MPLAB PICkit Basic tool or evaluation board/kit can be supported at a time.
Installation via pypi
Install and recover or switch firmware on supported targets:
pip install pycmsisdapswitcher
pycmsisdapswitcher --help
pycmsisdapswitcher --help
Usage
pycmsisdapswitcher target --source=<firmware source> --fwtype=<firmware type> --version --help
- target: Either the tool name or the kit name.
- Currently supported values:
- pickitbasic
- evalboard
- Currently supported values:
Optional Arguments
- -h --help: Shows the command line help
- --version: Shows the pycmsisdapswitcher version
- --source: Specifies the source of the firmware (default: server)
- Currently supported values:
- server: (default) latest firmware downloaded from Microchip tool packs public server
- firmware file name with relative or absolute path
- cache: firmware retrieved from a user directory, created and updated from server usage
- Currently supported values:
- --fwtype: Specifies the firmware type (default: cmsis)
- Currently supported values:
- mplab: Microchip implementation
- cmsis: Arm CMSIS-DAP v2 implementation
- Currently supported values:
Usage Examples
- pycmsisdapswitcher pickitbasic
- Switches the MPLAB PICkit Basic firmware to the latest CMSIS-DAP v2 implementation using the Microchip server
- pycmsisdapswitcher pickitbasic --source=pickit_basic_app.hex
- Switches the MPLAB PICkit Basic firmware to the one in the pickit_basic_app.hex file
- pycmsisdapswitcher pickitbasic --source=cache --fwtype=mplab
- Switches the MPLAB PICkit Basic firmware to the Microchip implementation available in the cache
Note for Linux® Users
USB devices need udev rules to be added to a .rules file in /etc/udev/rules.d.
Example: File pycmsisdapswitcher.rules content
# PICkit Basic (bootloader)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9057", MODE="0666"
# PICkit Basic (app, vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9054", MODE="0666"
# PICkit Basic (app, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9055", MODE="0666"
# PICkit Basic (app, vendor + CDC + vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9056", MODE="0666"
# PICkit Basic (cmsis2, vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ab", MODE="0666"
# PICkit Basic (cmsis2, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ac", MODE="0666"
# PICkit Basic (cmsis2, vendor + CDC + DGI)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ad", MODE="0666"
# PICkit Basic (cmsis2, vendor + CDC + DGI + MSD)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ae", MODE="0666"
# Eval board (bootloader)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810a", MODE="0666"
# Eval board (app)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="8109", MODE="0666"
# Eval board (app, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810b", MODE="0666"
# Eval board (app, vendor + MSD)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810c", MODE="0666"
# Eval board (app, vendor + CDC + DGI)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810d", MODE="0666"
# Eval board (cmsis2, vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904a", MODE="0666"
# Eval board (cmsis2, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904b", MODE="0666"
# Eval board (cmsis2, vendor + CDC + DGI)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904c", MODE="0666"
# Eval board (cmsis2, vendor + CDC + DGI + MSD)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904d", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9057", MODE="0666"
# PICkit Basic (app, vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9054", MODE="0666"
# PICkit Basic (app, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9055", MODE="0666"
# PICkit Basic (app, vendor + CDC + vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="9056", MODE="0666"
# PICkit Basic (cmsis2, vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ab", MODE="0666"
# PICkit Basic (cmsis2, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ac", MODE="0666"
# PICkit Basic (cmsis2, vendor + CDC + DGI)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ad", MODE="0666"
# PICkit Basic (cmsis2, vendor + CDC + DGI + MSD)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="90ae", MODE="0666"
# Eval board (bootloader)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810a", MODE="0666"
# Eval board (app)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="8109", MODE="0666"
# Eval board (app, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810b", MODE="0666"
# Eval board (app, vendor + MSD)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810c", MODE="0666"
# Eval board (app, vendor + CDC + DGI)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="810d", MODE="0666"
# Eval board (cmsis2, vendor)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904a", MODE="0666"
# Eval board (cmsis2, vendor + CDC)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904b", MODE="0666"
# Eval board (cmsis2, vendor + CDC + DGI)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904c", MODE="0666"
# Eval board (cmsis2, vendor + CDC + DGI + MSD)
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="904d", MODE="0666"
Note for Windows® Users
The following is an example of an error message:
The device has no langid (permission issue, no string descriptors supported or device error)
If the output shows such an error message, double-check in the Device Manager that the target (MPLAB PICkit Basic or evaluation board) has been bound to WinUSB. If it has not, you can manually bind the target to WinUSB by using either Zadig or the Microchip USB installer.