avrdudes / avrdude

AVRDUDE is a utility to program AVR microcontrollers
GNU General Public License v2.0
747 stars 138 forks source link

To supress the warning for Microchip SNAP #1135

Closed mcuee closed 2 years ago

mcuee commented 2 years ago

Right now there is always a warning messge avrdude_git.exe: usbhid_open(): No device found when you use Microchip SNAP.

I believe the reason is that the current code loops through the three USB PIDs (0x217F, 0x2180, 0x2181). Because it can not find the first one (0x217F), it prints out the warning message.

@MCUdude Just wondering where you get the info that SNAP has three USB PIDs. Thanks. Do you see the same warning message for Microchip PICKit 4?

From your pull-request that both SNAP and PICKit 4 will have three USB PIDs.

I am thinking maybe there is only one USB PID for the AVR mode. The other is for PIC mode and yet the other one is probably for FW update.

mcuee commented 2 years ago

A very simple work-around is to shift 0x217F to the last. But if it is confirmed that only 0x2180 is used for the AVR mode, we can remove the other two USB PIDs.

$ diff -u avrdude_git.conf avrdude.conf
--- avrdude_git.conf    2022-10-18 19:39:57.137234200 +0800
+++ avrdude.conf        2022-10-19 08:05:20.810931200 +0800
@@ -1957,7 +1957,7 @@
     type                   = "jtagice3_updi";
     prog_modes             = PM_UPDI;
     connection_type        = usb;
-    usbpid                 = 0x217f, 0x2180, 0x2181;
+    usbpid                 = 0x2180, 0x2181, 0x217f;
     hvupdi_support         = 1;
 ;

@@ -1971,7 +1971,7 @@
     type                   = "jtagice3_pdi";
     prog_modes             = PM_PDI;
     connection_type        = usb;
-    usbpid                 = 0x217f, 0x2180, 0x2181;
+    usbpid                 = 0x2180, 0x2181, 0x217f;
 ;

 #------------------------------------------------------------
@@ -1984,7 +1984,7 @@
     type                   = "jtagice3_isp";
     prog_modes             = PM_ISP;
     connection_type        = usb;
-    usbpid                 = 0x217f, 0x2180, 0x2181;
+    usbpid                 = 0x2180, 0x2181, 0x217f;
 ;

 #------------------------------------------------------------

Quick tets without target connected:

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_git -C .\avrdude_git.conf -p m4808 -c snap_updi
avrdude_git error: no device found

             Vtarget                      : 0.04 V
             JTAG clock megaAVR/program   : 1000 kHz
             JTAG clock megaAVR/debug     : 100 kHz
             PDI/UPDI clock Xmega/megaAVR : 100 kHz
avrdude_git error: initialization failed, rc=-1
            double check connections and try again or use -F to override
            this check

avrdude_git done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_git -C .\avrdude.conf -p m4808 -c snap_updi

             Vtarget                      : 0.04 V
             JTAG clock megaAVR/program   : 1000 kHz
             JTAG clock megaAVR/debug     : 100 kHz
             PDI/UPDI clock Xmega/megaAVR : 100 kHz
avrdude_git error: initialization failed, rc=-1
            double check connections and try again or use -F to override
            this check

avrdude_git done.  Thank you.
mcuee commented 2 years ago

1138 will fix this issue.