Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

AVR Programmer not working

I am trying to switch programmers from my old Sparkfun AVR Programmer with mini-USB to this nice looking Pololu V2.1.

I have a device in front of me (ATTiny841) that is easily programmed with the old one. Swapping to the Pololu, it does not work.’

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

The first line is what concerns me. is stk500v2 the correct type to use with avrdude?

#!/bin/bash
PORT=`pavr2cmd --prog-port`
PROG=stk500v2
MCU=attiny841

avrdude -c $PROG -p $MCU -U lfuse:w:0xe2:m -P $PORT

pavr2gui/pavr2cmd run with no problems and I can set the device to provide 5V power.

Another note that I have 5V output enabled but it does not seem to power the target. My code has a beep upon startup that is not heard when using the Pololu programmer. It is heard when using the Sparkfun programmer.

A power cycle of the device and a single programming attempt gives as follows:


greg@grexps:~/megadesk_tindie$ PORT=`pavr2cmd --prog-port`
greg@grexps:~/megadesk_tindie$ PROG=stk500v2
greg@grexps:~/megadesk_tindie$ MCU=attiny841
greg@grexps:~/megadesk_tindie$ avrdude -c $PROG -p $MCU -V -Uflash:w:megadesk-v4.hex:i -P $PORT 
greg@grexps:~/megadesk_tindie$ pavr2cmd -s

Name:                                    Pololu USB AVR Programmer v2.1
Serial number:                           00309332
Firmware version:                        1.02
Programming port:                        /dev/ttyACM0
TTL port:                                /dev/ttyACM1

Settings:
  ISP frequency (kHz):                   1714
  Max ISP frequency (kHz):               1714
  Regulator mode:                        5 V
  VCC output:                            Enabled
  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):      4512
  Target VCC measured maximum (mV):      4832
  Programmer VDD measured minimum (mV):  4800
  Programmer VDD measured maximum (mV):  4832

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

Hello.

It looks like you are trying to program with a high ISP frequency, 1714 kHz. What frequency is your AVR running at? Can you try using the default ISP frequency of 114 kHz? You can set that up by running pavr2cmd --freq 114.

- Patrick

Perhaps closer. The device is running at 8MHz on the internal oscillator.


avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.
avrdude done.  Thank you.

reg@grexps:~/megadesk_tindie$ pavr2cmd -s
Name:                                    Pololu USB AVR Programmer v2.1
Serial number:                           00309332
Firmware version:                        1.02
Programming port:                        /dev/ttyACM0
TTL port:                                /dev/ttyACM1

Settings:
  ISP frequency (kHz):                   750
  Max ISP frequency (kHz):               750
  Regulator mode:                        5 V
  VCC output:                            Enabled
  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:                     No error.
  Target VCC measured minimum (mV):      4736
  Target VCC measured maximum (mV):      4768
  Programmer VDD measured minimum (mV):  4768
  Programmer VDD measured maximum (mV):  4800

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

Ah, there was a loose connection not being made properly. I think it’s working now! Let me verify a few things.

Yes, it is flashing now, and looks like I can flash at 1714KHz with -B 0.5, probably the fastest possible speed for an 8MHz clock.

2 Likes

I am glad to hear that you got it working! Thanks for letting us know.

- Patrick