avrdude -x ascii -x cpufreq issues

Bus Pirate support for AVRDude AVR programmer

avrdude -x ascii -x cpufreq issues

Postby hudson » Sat Dec 22, 2012 4:21 pm

I've had problems with avrdude-5.11 and a buspirate v3b with firmware 5.10 on my Mac. My project requires an external clock, so my script runs avrdude with -x ascii -x cpufreq=125 since the recovery clock for XTAL1 on AUX is only supported in ASCII mode.

It looks like the GUI parsing is broken in ASCII mode -- the buspirate_readline_noexit() function is waiting for a newline, which is not printed with the prompt, so it eventually times out with avrdude: ser_recv(): programmer is not responding. Adding a break in the readline routine for '>' fixed the prompt parsing.

The next problem is that after a chip erase the pgm->initialize() function is called, which tries to reconfigure the PWM output. This fails since the g command both enables and disables the output, so the second time it turns it off rather than going back into the PWM menu. Just disabling the second call seems to be ok and prevents this from happening.

This patch to the current SVN head of avrdude fixes both of these issues. However, why is the recovery clock not supported in binary mode? The ASCII mode is painfully slow -- almost five minutes to flash an 8 KB chip!

Code: Select all
Index: buspirate.c
--- buspirate.c   (revision 1126)
+++ buspirate.c   (working copy)
@@ -195,6 +195,8 @@
      if (*buf_p == '\n')
+      if (*buf_p == '>')
+         break;
      if (*buf_p == EOF) {
         *buf_p = '\0';
@@ -940,7 +942,7 @@
   avr_set_bits(p->op[AVR_OP_CHIP_ERASE], cmd);
   pgm->cmd(pgm, cmd, res);
-   pgm->initialize(pgm, p);
+   //pgm->initialize(pgm, p);

   pgm->pgm_led(pgm, OFF);

Posts: 1
Joined: Sat Dec 22, 2012 4:02 pm

Re: avrdude -x ascii -x cpufreq issues

Postby ca0abinary » Sat Jan 19, 2013 10:57 pm

Thanks for this patch. For the unlucky among us using windows I went through the pain of compiling this for windows. Please find the latest source + the patch compiled for windows attached. It includes the two required cygwin dlls.
AVRDude 1/19/2013 source trunk Cygwin + Ascii CpuFreq Patch
(1.4 MiB) Downloaded 277 times
Posts: 1
Joined: Sat Jan 19, 2013 10:53 pm

Return to AVRDude