Unable to Upload Program with the Pololu USB AVR Programmer v2.1 using AVRDUDE

Hello,

For context, I’m quite new to operating microprocessors. Apologies in advance, if I’m slow to understand what I’m doing wrong.

I’m currently trying to upload a .hex file through the Pololu USB AVR Programmer v2.1. I’m doing so, using:

  • An ATmega324A microprocessor.
  • AVR-GCC (for MacOS) for file assembly and compilation.
  • AVRDUDE for uploading the program to the microprocessor.

When I first used the setup, I was able to pass the code to the AVR just fine.
But now, when I try and pass the same code again, I get the following error:

avrdude error: command failed
avrdude error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower the bit clock frequency, e.g. -B 125kHz
        - use -F to override this check

avrdude done.  Thank you.

After checking through some of the forum posts, I checked the Configuration Status and got this:

Name:                                    Pololu USB AVR Programmer v2.1
Serial number:                           00255520
Firmware version:                        1.02
Programming port:                        /dev/cu.usbmodem002555202
TTL port:                                /dev/cu.usbmodem002555204

Settings:
  ISP frequency (kHz):                   114
  Max ISP frequency (kHz):               1714
  Regulator mode:                        auto
  VCC output:                            Disabled
  VCC output indicator:                  Blinking
  Line A function:                       None
  Line B function:                       DTR
  VCC/VDD maximum range (mV):            896
  VCC 3.3 V minimum (mV):                2720
  VCC 3.3 V maximum (mV):                3872
  VCC 5 V minimum (mV):                  4128
  VCC 5 V maximum (mV):                  5856
  STK500 hardware version:               F
  STK500 software version:               2.A

Results from last programming:
  Programming error:                     Initial SPI command failed.
  Target VCC measured minimum (mV):      5120
  Target VCC measured maximum (mV):      5248
  Programmer VDD measured minimum (mV):  4896
  Programmer VDD measured maximum (mV):  4960

Current status:
  Target VCC (mV):                       5152
  Programmer VDD (mV):                   4928
  VDD regulator set point:               5 V
  Last device reset:                     Power-on reset

I tried rewiring the Vcc & GND wires of breadboard connecting to the AVR, but the result is the same.

Is there something I’m missing?

Hello,

After some fiddling, I was able to upload the file to the AVR by removing all the data wires from the microprocessor.

Are there any ideas why this could occur?

Hello.

Which pins on your microcontroller were you making connections to? It looks like the initial SPI command was failing, so you might double check to see if you are connecting anything to the SPI pins that could be causing interference.

Brandon

I’ve connect the Vcc & GND pins, as well as the pins linked to IO ports B and C.
Outside of that, I haven’t connected it to anything else.

Would you like me to post an image of the circuit setup?

In general, you need to be careful about connecting to the programming pins; other devices that read those pins (i.e. normally the AVR is an output and the other device is an input) are usually fine as long as they’re tolerant of the programming signals, but devices that drive those pins (e.g. the other device is an output and the AVR is an input) will usually interfere with the communication between the AVR and the programmer.

It is not clear to me which specific pins you are referring to when you say “IO ports B and C” (e.g. all of the pins on each port PB0-7 and PC0-7?), but from the ATmega324A datasheet, it looks like the SPI pins are PB5 (MOSI), PB6 (MISO), and PB7 (SCK), which are pins 6-8. Pictures of your setup or a wiring diagram might help, but since it sounds like the programmer is working fine and the issue might be with the AVR or your circuit, you might consider posting on the Microchip or AVR Freaks forum.

Brandon