Add alternative USB PID for PICkit4/SNAP in PIC mode

This commit is contained in:
MCUdude 2022-12-14 20:11:43 +01:00
parent 159d12693e
commit 30e90bdfd2
2 changed files with 29 additions and 17 deletions

View File

@ -1497,6 +1497,11 @@ int jtag3_open_common(PROGRAMMER *pgm, const char *port) {
pinfo.usbinfo.vid = USB_VENDOR_MICROCHIP;
pinfo.usbinfo.pid = USB_DEVICE_SNAP_PIC_MODE;
int pic_mode = serial_open(port, pinfo, &pgm->fd);
if(pic_mode < 0) {
// Retry with alternative USB PID
pinfo.usbinfo.pid = USB_DEVICE_SNAP_PIC_MODE_ALT;
pic_mode = serial_open(port, pinfo, &pgm->fd);
}
if(pic_mode >= 0) {
msg_error("\n");
pmsg_error("MPLAB SNAP in PIC mode detected!\n");
@ -1507,6 +1512,11 @@ int jtag3_open_common(PROGRAMMER *pgm, const char *port) {
pinfo.usbinfo.vid = USB_VENDOR_MICROCHIP;
pinfo.usbinfo.pid = USB_DEVICE_PICKIT4_PIC_MODE;
int pic_mode = serial_open(port, pinfo, &pgm->fd);
if(pic_mode < 0) {
// Retry with alternative USB PID
pinfo.usbinfo.pid = USB_DEVICE_PICKIT4_PIC_MODE_ALT;
pic_mode = serial_open(port, pinfo, &pgm->fd);
}
if(pic_mode >= 0) {
msg_error("\n");
pmsg_error("PICkit4 in PIC mode detected!\n");

View File

@ -41,8 +41,10 @@
#define USB_DEVICE_PKOBN 0x2175
#define USB_DEVICE_PICKIT4_AVR_MODE 0x2177
#define USB_DEVICE_PICKIT4_PIC_MODE 0x9012
#define USB_DEVICE_PICKIT4_PIC_MODE_ALT 0x9017
#define USB_DEVICE_SNAP_AVR_MODE 0x2180
#define USB_DEVICE_SNAP_PIC_MODE 0x9018
#define USB_DEVICE_SNAP_PIC_MODE_ALT 0x9019
#define USB_VENDOR_FTDI 0x0403
#define USB_DEVICE_FT2232 0x6010