Mon 17 Nov 2014 04:42:50 PM UTC, original submission:
While investigating a problem, I noticed the timeouts for stk500v2_recv are a bit inconsistent. In particular, ser_posix defines:
long serial_recv_timeout = 5000; /* ms */
While stk500v2.c defines:
#define SERIAL_TIMEOUT 2
In practice, I think this means that when no data is being received, serial_recv blocks for 5 seconds. However, when a byte (that is not the final byte in the packet) is received, > 2 seconds after stk500v2_recv was called, it returns a timeout immediately.
Effectively this means that there's 3 seconds spent waiting for data this won't be processed anyway (unless it's the last byte).
Additionally, it seems that the 5 second timeout coincides with the timeout specified by AVR068 for "data" packets and it seems useful to let avrdude timeout (and thus retry) before the stk500 times out.
> The total timeout period is from a command is sent to the answer must be
> completely received. The total timeout period is 200 ms for the
> CMD_SIGN_ON command, 5 seconds for the CMD_READ/PROGRAM_FLASH/EEPROM
> commands, and 1 second for all other commands.
|