Skip to main content
Topic: avrdude -x ascii -x cpufreq issues (Read 4249 times) previous topic - next topic

avrdude -x ascii -x cpufreq issues

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 [tt:]-x ascii -x cpufreq=125[/tt:] 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 [tt:]buspirate_readline_noexit()[/tt:] function is waiting for a newline, which is not printed with the prompt, so it eventually times out with [tt:]avrdude: ser_recv(): programmer is not responding[/tt:].  Adding a break in the readline routine for [tt:]'>'[/tt:] fixed the prompt parsing.

The next problem is that after a chip erase the [tt:]pgm->initialize()[/tt:] function is called, which tries to reconfigure the PWM output.  This fails since the [tt:]g[/tt:] 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]
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 = '';
@@ -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);

Re: avrdude -x ascii -x cpufreq issues

Reply #1
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.