Re: timeouts on USB ISP programmer

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Fri, 08 Apr 2022 03:33:22 UTC
Mystery solved ;-)

For avrdude `-P` parameter defines the the programmer port __BUT__ (as
obviously stated in man page) if you use `usb:` device then you need
to provide programmer SERIAL NUMBER last bytes not the OS serial port
device ;-)

If you run avrdude with `-vvv` switch then you get increased
verbosity. It will tell you what it found. You will notice that it
found a device that matches VID:PID pair but not Serial NUMBER of the
device (not the port) ;-)

Details here: https://github.com/avrdudes/avrdude/issues/920

Because avrdude keeps all its Programmer and Target definitions in a
configuration file it is possible to define completely new Programmer
and Target MCU with a simple commands in `~/.avrduderc` (see
`/usr/local/etc/avrdude.conf` for reference).

It is also possible to build the port with `cd
/usr/ports/devel/avrdude; make WITH_DEBUG=1; make reinstall` to obtain
binary that can be easily debugged with `lldb` (btw I just discovered
`gui` option). `usbhid_open()` and/or `usbdev_open()` is the place
where VID:PID and serial is handled.

I hope that helps move things forward :-)

Tomek


% avrdude -c xplainedmini -p t416 -P usb:3537 -vvv

avrdude: Version 6.4
         Copyright (c) Brian Dean, http://www.bdmicro.com/
         Copyright (c) Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/XXX/.avrduderc"

         Using Port                    : usb:3537
         Using Programmer              : xplainedmini
avrdude: stk500v2_jtag3_open()
avrdude: usbhid_open(): Found mEDBG CMSIS-DAP, serno: ATML2795042700003537
avrdude: usbhid_open(): Opening path 0-3.4.4:1.0
avrdude: usbhid_open(): Probing for max. packet size
avrdude: usbhid_open(): Setting max_xfer from DAP_Info response to 64
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
avrdude: jtag3_getsync()
avrdude: Sending sign-on command:
avrdude: jtag3_edbg_send(): sending 3 bytes
avrdude: jtag3_recv(): Got message seqno 0 (command_sequence == 0)

[general] OK
         AVR Part                      : ATtiny416
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :


-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info