Improve the initializion sequence of the butterfly so it is more likely

to synchronize with the device.

bug #9787 overview: avrdude 4.4.0 correct butterfly interface


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@496 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2005-09-16 14:54:55 +00:00
parent 8bf2adbed2
commit 90db0f17c6
2 changed files with 27 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2005-09-16 Joerg Wunsch <j@uriah.heep.sax.de>
* butterfly.c: improve the butterfly initialization so it is more likely
to synchonize; [bug #9787: avrdude 4.4.0 correct butterfly interface]
2005-09-14 Joerg Wunsch <j@uriah.heep.sax.de> 2005-09-14 Joerg Wunsch <j@uriah.heep.sax.de>
* avrdude.conf.in: add a jtag2slow programmer alias, and make * avrdude.conf.in: add a jtag2slow programmer alias, and make

View File

@ -235,15 +235,25 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
* Send some ESC to activate butterfly bootloader. This is not needed * Send some ESC to activate butterfly bootloader. This is not needed
* for plain avr109 bootloaders but does not harm there either. * for plain avr109 bootloaders but does not harm there either.
*/ */
butterfly_send(pgm, "\033\033\033\033", 4); fprintf(stderr, "Connecting to programmer: ");
do {
putc('.', stderr);
butterfly_send(pgm, "\033", 1);
butterfly_drain(pgm, 0); butterfly_drain(pgm, 0);
/* Get the programmer identifier. Programmer returns exactly 7 chars
_without_ the null.*/
butterfly_send(pgm, "S", 1); butterfly_send(pgm, "S", 1);
memset (id, 0, sizeof(id)); butterfly_recv(pgm, &c, 1);
butterfly_recv(pgm, id, sizeof(id)-1); if (c != '?') {
putc('\n', stderr);
/*
* Got a useful response, continue getting the programmer
* identifier. Programmer returns exactly 7 chars _without_
* the null.
*/
id[0] = c;
butterfly_recv(pgm, &id[1], sizeof(id)-2);
id[sizeof(id)-1] = '\0';
}
} while (c == '?');
/* Get the HW and SW versions to see if the programmer is present. */ /* Get the HW and SW versions to see if the programmer is present. */
@ -327,6 +337,9 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
butterfly_send(pgm, buf, 2); butterfly_send(pgm, buf, 2);
butterfly_vfy_cmd_sent(pgm, "select device"); butterfly_vfy_cmd_sent(pgm, "select device");
if (dev_supported)
butterfly_enter_prog_mode(pgm);
return dev_supported? 0: -1; return dev_supported? 0: -1;
} }
@ -346,8 +359,6 @@ static void butterfly_enable(PROGRAMMER * pgm)
{ {
no_show_func_info(); no_show_func_info();
butterfly_enter_prog_mode(pgm);
return; return;
} }