mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-23 17:46:33 +03:00
Update urclock/stk500 reset times and streamline DTR/RTS twiddling
This commit is contained in:
@@ -88,7 +88,13 @@ static int arduino_open(PROGRAMMER *pgm, const char *port) {
|
||||
// This code assumes a negative-logic USB to TTL serial adapter
|
||||
// Set RTS/DTR high to discharge the series-capacitor, if present
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
usleep(50 * 1000);
|
||||
/*
|
||||
* Long wait needed for optiboot: otherwise the second of two bootloader
|
||||
* calls in quick succession fails:
|
||||
*
|
||||
* avrdude -c arduino -qqp m328p -U x.hex; avrdude -c arduino -qqp m328p -U x.hex
|
||||
*/
|
||||
usleep(250 * 1000);
|
||||
// Pull the RTS/DTR line low to reset AVR
|
||||
serial_set_dtr_rts(&pgm->fd, 1);
|
||||
usleep(50 * 1000);
|
||||
|
||||
@@ -98,15 +98,11 @@ int stk500_getsync(const PROGRAMMER *pgm) {
|
||||
// Restart Arduino bootloader for every sync attempt
|
||||
if (strcmp(pgm->type, "Arduino") == 0 && attempt > 0) {
|
||||
// This code assumes a negative-logic USB to TTL serial adapter
|
||||
// Set RTS/DTR high to discharge the series-capacitor, if present
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
usleep(50 * 1000);
|
||||
// Pull the RTS/DTR line low to reset AVR
|
||||
// Pull the RTS/DTR line low to reset AVR: it is still high from open()/last attempt
|
||||
serial_set_dtr_rts(&pgm->fd, 1);
|
||||
usleep(50 * 1000);
|
||||
usleep(20*1000);
|
||||
// Set the RTS/DTR line back to high
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
usleep(50 * 1000);
|
||||
stk500_drain(pgm, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2240,16 +2240,15 @@ static int urclock_open(PROGRAMMER *pgm, const char *port) {
|
||||
// This code assumes a negative-logic USB to TTL serial adapter
|
||||
// Set RTS/DTR high to discharge the series-capacitor, if present
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
usleep(50 * 1000);
|
||||
usleep(20*1000);
|
||||
// Pull the RTS/DTR line low to reset AVR
|
||||
serial_set_dtr_rts(&pgm->fd, 1);
|
||||
usleep(50 * 1000);
|
||||
usleep(20*1000);
|
||||
// Set the RTS/DTR line back to high
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
usleep(50 * 1000);
|
||||
|
||||
if((70+ur.delay) > 0)
|
||||
usleep((70+ur.delay)*1000); // Wait until board comes out of reset
|
||||
if((100+ur.delay) > 0)
|
||||
usleep((100+ur.delay)*1000); // Wait until board comes out of reset
|
||||
|
||||
pmsg_debug("%4ld ms: enter urclock_getsync()\n", avr_mstimestamp());
|
||||
if(urclock_getsync(pgm) < 0)
|
||||
|
||||
Reference in New Issue
Block a user