Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix probing of the generic -c stk500 programmer #1468

Merged
merged 7 commits into from
Aug 4, 2023

Conversation

stefanrueger
Copy link
Collaborator

Fixes #1467

@MCUdude
Copy link
Collaborator

MCUdude commented Jul 17, 2023

I'm getting a segmentation fault. And I promise I've cleaned everything and done a fresh build.

$ ./avrdude -cstk500 -P /dev/cu.usbserial -patmega8515 -v

avrdude: Version 7.1-20230108
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /Users/hans/Downloads/avrdude-terminal/src/avrdude.conf
         User configuration file is /Users/hans/.avrduderc

         Using Port                    : /dev/cu.usbserial
         Using Programmer              : stk500
Segmentation fault: 11

@stefanrueger
Copy link
Collaborator Author

segmentation fault

I guess stk500v1 has added a setup call in the last decade; have added the setup() call before probing stk500v1. Try now

@mcuee mcuee added the bug Something isn't working label Jul 17, 2023
@MCUdude
Copy link
Collaborator

MCUdude commented Jul 17, 2023

Now -cstk500 works immediately with the stk500v1 firmware, but it takes a really long time for it to time out and switch to stk500v2.

Ideally, it should try with stk500v2 first, and if this times out, switch to stk500v1. As you can see, it took almost a minute to connect

$ time ./avrdude -cstk500 -P /dev/cu.usbserial -patmega8515
avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 2 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 3 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 4 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 5 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 6 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 7 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 8 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 9 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 10 of 10: not in sync: resp=0x00
avrdude: successfully opened stk500v2 device; please use -c stk500v2
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9306 (probably m8515)

avrdude done.  Thank you.


real	0m51.745s
user	0m0.076s
sys	0m0.022s

@mcuee
Copy link
Collaborator

mcuee commented Jul 17, 2023

Now -cstk500 works immediately with the stk500v1 firmware, but it takes a really long time for it to time out and switch to stk500v2.

Indeed it is pretty fast for STK500v1.

PS C:\work\avr\avrdude_test\avrdude_bin> Measure-Command {.\avrdude_pr1468 -c stk500 -P COM49 -p m16a}
avrdude_pr1468: successfully opened stk500v1 device; please use -c stk500v1
avrdude_pr1468: AVR device initialized and ready to accept instructions
avrdude_pr1468: device signature = 0x1e9403 (probably m16a)

avrdude_pr1468 done.  Thank you.


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 932
Ticks             : 19321974
TotalDays         : 2.23633958333333E-05
TotalHours        : 0.0005367215
TotalMinutes      : 0.03220329
TotalSeconds      : 1.9321974
TotalMilliseconds : 1932.1974

And indeed very slow for STK500v2. In fact, it causes issues with my CH340 STK500v2 clone, which is a regression.

PS C:\work\avr\avrdude_test\avrdude_bin> Measure-Command {.\avrdude_pr1468 -c stk500 -P COM2 -p t88}
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 1 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 2 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 3 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 4 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 5 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 6 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 7 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 8 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 9 of 10: not in sync: resp=0x00
avrdude_pr1468 error: programmer is not responding
avrdude_pr1468 warning: attempt 10 of 10: not in sync: resp=0x00
avrdude_pr1468 error: cannot open port \\.\COM2: Access is denied.

avrdude_pr1468 error: cannot open either stk500v1 or stk500v2 programmer
avrdude_pr1468 error: unable to open programmer stk500 on port COM2

avrdude_pr1468 done.  Thank you.


Days              : 0
Hours             : 0
Minutes           : 1
Seconds           : 42
Milliseconds      : 255
Ticks             : 1022550857
TotalDays         : 0.00118350793634259
TotalHours        : 0.0284041904722222
TotalMinutes      : 1.70425142833333
TotalSeconds      : 102.2550857
TotalMilliseconds : 102255.0857

The clone has no issues with git main with either -c stk500 or -c stk500v2.

PS C:\work\avr\avrdude_test\avrdude_bin> Measure-Command {.\avrdude -c stk500 -P COM2 -p t88}
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9311 (probably t88)

avrdude done.  Thank you.


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 371
Ticks             : 13714086
TotalDays         : 1.58727847222222E-05
TotalHours        : 0.000380946833333333
TotalMinutes      : 0.02285681
TotalSeconds      : 1.3714086
TotalMilliseconds : 1371.4086

PS C:\work\avr\avrdude_test\avrdude_bin> Measure-Command {.\avrdude -c stk500v2 -P COM2 -p t88}
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9311 (probably t88)

avrdude done.  Thank you.


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 368
Ticks             : 13681491
TotalDays         : 1.58350590277778E-05
TotalHours        : 0.000380041416666667
TotalMinutes      : 0.022802485
TotalSeconds      : 1.3681491
TotalMilliseconds : 1368.1491

@mcuee
Copy link
Collaborator

mcuee commented Jul 17, 2023

Ideally, it should try with stk500v2 first, and if this times out, switch to stk500v1. As you can see, it took almost a minute to connect

Since STK500 V1 FW is rare, I tend to agree with @MCUdude here. And this is more inline with git main now.

@stefanrueger

Since this change causes regression for my CH340 STK500v2 clone, I think it is better to follow the suggestion from @MCUdude .

@stefanrueger
Copy link
Collaborator Author

OK, makes sense to probe v2 first then v1. I added the matching teardown call given the respective programmer's setup() call. Warrants checking with

  • An STK500v2 programmer
  • An STK500v1 programmer
  • Something else (neither STK500v1 nor STK500v2)

@MCUdude
Copy link
Collaborator

MCUdude commented Jul 17, 2023

The problem now is that there isn't a limit to how many times Avrdude tried to connect to an stk500v2 target, and it takes somewhere between 5 and 10 seconds between each retry attempt. It also spits out a false "successfully opened stk500v2 device; please use -c stk500v2" message.

(STK500 board running stk500v1 firmware):

$ time ./avrdude -cstk500 -P /dev/cu.usbserial -patmega8515 -v

avrdude: Version 7.1-20230108
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /Users/hans/Downloads/avrdude-terminal/src/avrdude.conf
         User configuration file is /Users/hans/.avrduderc

         Using Port                    : /dev/cu.usbserial
         Using Programmer              : stk500
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_getsync() error: timeout communicating with programmer
avrdude: successfully opened stk500v2 device; please use -c stk500v2
         AVR Part                      : ATmega8515
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom                  4    20   128    0 no        512    1      0  9000  9000 0xff 0xff
           flash                  33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          4    1      0     0     0 0x00 0x00

         Programmer Type : STK500V2
         Description     : Atmel STK500
         Programmer Model: Unknown
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_getsync() error: timeout communicating with programmer
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_getsync() error: timeout communicating with programmer
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_getsync() error: timeout communicating with programmer
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_getsync() error: timeout communicating with programmer
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
avrdude stk500v2_recv() error: timeout
^C

real	3m6.859s
user	0m0.080s
sys	0m0.024s

@stefanrueger
Copy link
Collaborator Author

false "successfully opened stk500v2 device; please use -c stk500v2" message

Aha, so the intended probing algorithm never would have worked, because stk500v2_open() returns 0 despite comms failure. have repaired stk500v2_open() in that respect and stk600v2_open() too (while I was at it). So, someone should try an STK600 programmer once.

@MCUdude
Copy link
Collaborator

MCUdude commented Jul 17, 2023

It now works with the stk500v1, but it takes quite a while before it switches to stk500v1. But that's fine I think. At least better than before!

$ time ./avrdude -cstk500 -P /dev/cu.usbserial -patmega8515
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout communicating with programmer
avrdude: successfully opened stk500v1 device; please use -c stk500v1
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9306 (probably m8515)

avrdude done.  Thank you.


real	0m31.509s
user	0m0.137s
sys	0m0.035s

With a board running stk500v2 firmware, it's just quick as one would expect:

$ time ./avrdude -cstk500 -P /dev/cu.usbserial -patmega8515
avrdude: successfully opened stk500v2 device; please use -c stk500v2
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9306 (probably m8515)

avrdude done.  Thank you.


real	0m0.760s
user	0m0.114s
sys	0m0.031s

The STK600 also works:

$./avrdude -cstk600 -patmega2560
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9801 (probably m2560)

avrdude done.  Thank you.

…ailure

... as it might have been that probing with stk500v2 protocol threw a
stk500v1 firmware off its rails
@stefanrueger
Copy link
Collaborator Author

takes quite a while before it switches to stk500v1

... which means that some genuine stk500v1-protocol programmer might at this point already have given up comms and no longer synch. Hence, I think we should change the error message "cannot open either stk500v1 or stk500v2 programmer" to "probing stk500v2 failed, as did stk500v1; perhaps try -c stk500v1"

@mcuee
Copy link
Collaborator

mcuee commented Jul 23, 2023

It now works with the stk500v1, but it takes quite a while before it switches to stk500v1.

@MCUdude and @stefanrueger

It seems to me avrdude 5.2 version works very well. Maybe we can follow its behaviour if possible. Basically it tries to detect STK500V1 first (one retry??) and then try the V2.

The high number of retrys probably only for the bootloader mode and maybe Arduino as ISP (need to check). Now we recommend users to use -c arduino and -c arduino_as_isp, so we can reduce the retry count for real STK500 V1/V2 FW.

Good thing is that all the avrdude version from the following sites still work under my Ubuntu 20.04 machine (including 4.4 version which was released back in 19-July-2004). Kudos to @dl8dtl and Brian S Dean.
http://download.savannah.gnu.org/releases/avrdude

It has short delay for STK500 V2 devices (maybe only one retry, I have not looked at the codes).

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/oldrelease$ ./avrdude5.2 -C ./avrdude5.2.conf -c stk500 -P /dev/ttyUSB1 -p m16 
avrdude5.2: stk500_recv(): programmer is not responding
avrdude5.2: successfully opened stk500v2 device -- please use -c stk500v2

avrdude5.2: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.07s

avrdude5.2: Device signature = 0x1e9403

avrdude5.2: safemode: Fuses OK

avrdude5.2 done.  Thank you.

It has almost no delay with STK500 V1 devices.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/oldrelease$ ./avrdude5.2 -C ./avrdude5.2.conf -c stk500 -P /dev/ttyUSB0 -p m16 
avrdude5.2: successfully opened stk500v1 device -- please use -c stk500v1

avrdude5.2: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude5.2: Device signature = 0x1e9403

avrdude5.2: safemode: Fuses OK

avrdude5.2 done.  Thank you.

BTW, it seems to me -c s500tk is for V1 and -c stk500v2 is for V2, for avrdude version 5.0 and 5.1. avrdude 4.4 only supports -c stk500 which is for V1 only.

@mcuee
Copy link
Collaborator

mcuee commented Jul 23, 2023

@stefanrueger

I am in general okay with this PR (to detect V2 first and then V1) but I would like to reduce the retry count to 1 or 2 if the user uses -c stk500.

Note;
/dev/ttyUSB0 -- STK500 clone with V1 official FW
/dev/ttyUSB1 -- STK500v2 clone (not official FW).

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude_pr1468 -C ./avrdude_pr1468.conf -c stk500v1 -P /dev/ttyUSB0 -p m16
avrdude_pr1468: AVR device initialized and ready to accept instructions
avrdude_pr1468: device signature = 0x1e9403 (probably m16)

avrdude_pr1468 done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude_pr1468 -C ./avrdude_pr1468.conf -c stk500 -P /dev/ttyUSB0 -p m16
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout communicating with programmer
avrdude_pr1468: successfully opened stk500v1 device; please use -c stk500v1
avrdude_pr1468: AVR device initialized and ready to accept instructions
avrdude_pr1468: device signature = 0x1e9403 (probably m16)

avrdude_pr1468 done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude_pr1468 -C ./avrdude_pr1468.conf -c stk500v2 -P /dev/ttyUSB1 -p m16
avrdude_pr1468: AVR device initialized and ready to accept instructions
avrdude_pr1468: device signature = 0x1e9403 (probably m16)

avrdude_pr1468 done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude_pr1468 -C ./avrdude_pr1468.conf -c stk500 -P /dev/ttyUSB1 -p m16
avrdude_pr1468: successfully opened stk500v2 device; please use -c stk500v2
avrdude_pr1468: AVR device initialized and ready to accept instructions
avrdude_pr1468: device signature = 0x1e9403 (probably m16)

avrdude_pr1468 done.  Thank you.

@MCUdude
Copy link
Collaborator

MCUdude commented Jul 23, 2023

The stk500v2 implementation has a hard-coded number of timeouts. The stk500v1 has a user specifiable timeout count

@mcuee
Copy link
Collaborator

mcuee commented Jul 23, 2023

The stk500v2 implementation has a hard-coded number of timeouts.

I think we can change the behavior for real programmers. We can keep the higher number of retry for bootloaders. But maybe we can ask @dl8dtl to see why we have a hard coded retry count.

And it is good to have a user specifiable retry count.

The stk500v1 has a user specifiable timeout count

@mcuee
Copy link
Collaborator

mcuee commented Jul 23, 2023

This PR is of course better than git main. But I will compare with old avrdude 5.2 version.

Test with Arduino as ISP.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1468 -C .\avrdude_pr1468.conf -c stk500 -P COM2 -b 19200 -p m16a
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout communicating with programmer
avrdude_pr1468 error: cannot open port \\.\COM2: Access is denied.

avrdude_pr1468 error: probing stk500v2 failed, as did stk500v1; perhaps try -c stk500v1
avrdude_pr1468 error: unable to open programmer stk500 on port COM2

avrdude_pr1468 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c stk500 -P COM2 -b 19200 -p m16a
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout communicating with programmer
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout communicating with programmer
avrdude error: timeout
...
CTRL-C

@mcuee
Copy link
Collaborator

mcuee commented Jul 23, 2023

Comparison with avrdude 5.2 under Linux, for "Arduino as ISP".

I think this PR is okay and it behaves better under Linux (it can recover) than under Windows (it can not recover) when using -c stk500.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude_pr1468 -C ./avrdude_pr1468.conf -c stk500 -P /dev/ttyUSB0 -b 19200 -p m16a
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout
avrdude_pr1468 error: timeout communicating with programmer
avrdude_pr1468: successfully opened stk500v1 device; please use -c stk500v1
avrdude_pr1468: AVR device initialized and ready to accept instructions
avrdude_pr1468: device signature = 0x1e9403 (probably m16a)

avrdude_pr1468 done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude -c arduino_as_isp -P /dev/ttyUSB0 -b 19200 -p m16a
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9403 (probably m16a)

avrdude done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ ./avrdude -c stk500 -P /dev/ttyUSB0 -b 19200 -p m16a
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout
avrdude error: timeout communicating with programmer
avrdude error: timeout
avrdude error: timeout
^C

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin$ cd oldrelease/

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/oldrelease$ ./avrdude5.2 -C ./avrdude5.2.conf -c stk500 -P /dev/ttyUSB0 -b 19200 -p m16
avrdude5.2: successfully opened stk500v1 device -- please use -c stk500v1

avrdude5.2: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude5.2: Device signature = 0x1e9403

avrdude5.2: safemode: Fuses OK

avrdude5.2 done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/oldrelease$ ./avrdude5.2 -C ./avrdude5.2.conf -c stk500v1 -P /dev/ttyUSB0 -b 19200 -p m16

avrdude5.2: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude5.2: Device signature = 0x1e9403

avrdude5.2: safemode: Fuses OK

avrdude5.2 done.  Thank you.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/oldrelease$ ./avrdude5.2 -C ./avrdude5.2.conf -c stk500v2 -P /dev/ttyUSB0 -b 19200 -p m16
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
avrdude5.2: stk500_2_ReceiveMessage(): timeout
^C

@mcuee
Copy link
Collaborator

mcuee commented Jul 23, 2023

I think this PR is okay and it behaves better under Linux (it can recover) than under Windows (it can not recover) when using -c stk500.

@stefanrueger

I am still thinking that we should probably reduce the number of retry count for stk500v2 probe, for real programmers (not for bootloaders). It would be good to have a retry count just like -c urclock. That can probably be extended to stk500v1 as well.

@stefanrueger
Copy link
Collaborator Author

retry count

I have always been suspicious about retrying without changes and rarely seen examples where that works. Given that programmers do different things at startup there is no simple rule, and limiting the retry count is rarely a success.

@mcuee
Copy link
Collaborator

mcuee commented Jul 24, 2023

retry count

I have always been suspicious about retrying without changes and rarely seen examples where that works.

Same here. I tend to think 3 or more retries do not help in general.

Given that programmers do different things at startup there is no simple rule, and limiting the retry count is rarely a success.

Okay then.

@mcuee
Copy link
Collaborator

mcuee commented Jul 24, 2023

I am okay with this PR even though I still prefer just to change the documentation to say now -c stk500 is the same as -c stk500v2.

@mcuee
Copy link
Collaborator

mcuee commented Jul 30, 2023

I am okay with this PR even though I still prefer just to change the documentation to say now -c stk500 is the same as -c stk500v2.

@stefanrueger
Now I think it is better to go with this PR in the end.

@stefanrueger stefanrueger merged commit 70190be into avrdudes:main Aug 4, 2023
10 checks passed
@stefanrueger stefanrueger deleted the stk500 branch August 4, 2023 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-c stk500 only works with devices that's running stk500v2 firmware
3 participants