Check for PICkit4 or SNAP in PIC mode
This commit is contained in:
parent
b083416e3b
commit
14446950df
24
src/jtag3.c
24
src/jtag3.c
|
@ -1504,6 +1504,30 @@ int jtag3_open_common(PROGRAMMER *pgm, const char *port) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (rv < 0) {
|
if (rv < 0) {
|
||||||
|
// Check if SNAP or PICkit4 is in PIC mode
|
||||||
|
for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
|
||||||
|
if (matches(ldata(ln), "snap")) {
|
||||||
|
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) {
|
||||||
|
msg_error("\n");
|
||||||
|
pmsg_error("MPLAB SNAP in PIC mode detected!\n");
|
||||||
|
imsg_error("Use MPLAB X or Microchip Studio to switch to AVR mode\n\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else if(matches(ldata(ln), "pickit4")) {
|
||||||
|
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) {
|
||||||
|
msg_error("\n");
|
||||||
|
pmsg_error("PICkit4 in PIC mode detected!\n");
|
||||||
|
imsg_error("Use MPLAB X or Microchip Studio to switch to AVR mode\n\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pmsg_error("did not find any device matching VID 0x%04x and PID list: ",
|
pmsg_error("did not find any device matching VID 0x%04x and PID list: ",
|
||||||
(unsigned) pinfo.usbinfo.vid);
|
(unsigned) pinfo.usbinfo.vid);
|
||||||
int notfirst = 0;
|
int notfirst = 0;
|
||||||
|
|
Loading…
Reference in New Issue