diff --git a/ChangeLog b/ChangeLog index fb66db70..e9730e98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-01 Joerg Wunsch + + Contributed by as + patch #4372: Better synchronization for stk500 + * stk500.c: Sync three times, and drop any noise inbetween. + 2006-09-01 Joerg Wunsch * avrdude.conf.in (ATtiny261, ATtiny461, ATtiny861): new diff --git a/stk500.c b/stk500.c index b131a720..170962dd 100644 --- a/stk500.c +++ b/stk500.c @@ -90,6 +90,16 @@ static int stk500_getsync(PROGRAMMER * pgm) * get in sync */ buf[0] = Cmnd_STK_GET_SYNC; buf[1] = Sync_CRC_EOP; + + /* + * First send and drain a few times to get rid of line noise + */ + + stk500_send(pgm, buf, 2); + stk500_drain(pgm, 0); + stk500_send(pgm, buf, 2); + stk500_drain(pgm, 0); + stk500_send(pgm, buf, 2); stk500_recv(pgm, resp, 1); if (resp[0] != Resp_STK_INSYNC) {