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

Reduce stk500v2_getsync() timeout #1506

Merged

Conversation

stefanrueger
Copy link
Collaborator

Serial reads utilise a global variable serial_recv_timeout, which is set to 5 s by default. Any stk500v2_getsync() attempt that fails because the board took longer to come out of reset than AVRDUDE had bargained for and therefore missed the sync command will out of necessity be blocked for 5 s. This is far too long. This PR reduces the serial receive timeout to 200 ms, which should be long enough for most comms, even if the data have to swirl around through wifi packets...

This also gets -c wiring to fail quicker in case the target board does not have a wiring bootloader or cannot trigger reset from DTR/RTS lines.

@stefanrueger stefanrueger added the enhancement New feature or request label Sep 26, 2023
@mcuee
Copy link
Collaborator

mcuee commented Sep 27, 2023

No regression under Windows for my Mega2560 CH340 clone.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1506 -C .\avrdude_pr1506.conf -c wiring -P COM40 -p m2560 -D -U .\hex2\blink-mega2560+lext-test.hex
avrdude_pr1506: AVR device initialized and ready to accept instructions
avrdude_pr1506: device signature = 0x1e9801 (probably m2560)

avrdude_pr1506: processing -U flash:w:.\hex2\blink-mega2560+lext-test.hex:i
avrdude_pr1506: reading input file .\hex2\blink-mega2560+lext-test.hex for flash
                with 1346 bytes in 4 sections within [0, 0x3106d]
                using 7 pages and 446 pad bytes
avrdude_pr1506: writing 1346 bytes flash ...
Writing | ################################################## | 100% 0.31 s
avrdude_pr1506: 1346 bytes of flash written
avrdude_pr1506: verifying flash memory against .\hex2\blink-mega2560+lext-test.hex
Reading | ################################################## | 100% 0.15 s
avrdude_pr1506: 1346 bytes of flash verified

avrdude_pr1506 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_git -C .\avrdude_pr1506.conf -c wiring -P COM40 -p m2560 -D -U .\hex2\blink-mega2560+lext-test.hex
avrdude_git: AVR device initialized and ready to accept instructions
avrdude_git: device signature = 0x1e9801 (probably m2560)

avrdude_git: processing -U flash:w:.\hex2\blink-mega2560+lext-test.hex:i
avrdude_git: reading input file .\hex2\blink-mega2560+lext-test.hex for flash
             with 1346 bytes in 4 sections within [0, 0x3106d]
             using 7 pages and 446 pad bytes
avrdude_git: writing 1346 bytes flash ...
Writing | ################################################## | 100% 0.31 s
avrdude_git: 1346 bytes of flash written
avrdude_git: verifying flash memory against .\hex2\blink-mega2560+lext-test.hex
Reading | ################################################## | 100% 0.15 s
avrdude_git: 1346 bytes of flash verified

avrdude_git done.  Thank you.

@stefanrueger stefanrueger merged commit 70e5307 into avrdudes:main Sep 28, 2023
10 checks passed
@stefanrueger stefanrueger deleted the reduce-stk500v2-getsync-timeout branch September 28, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants