Getting errors using the Pololu USB AVR Programmer

Hi there,

I just got this programmer and I am getting an error when using the Pololu USB AVR Programmer with both AVR Studio 5.1 and avrdude. (Windows). I am using firmware version 1.07.

I am trying to program a ATMEGA32U4 (16 MHz system clock, with ISP clock on the AVR Programmer set as low as it can go: 1.5 kHz), but can’t get the programmer to talk to it correctly. I have double checked my wiring on the target board and everything seems correct. The Pololu AVR programmer can detect the target board’s VDD (4.8V) and the yellow LED blinks to confirm this.
The error in AVR Studio 5.1 is:

ModuleName:	TCF (TCF command: Device:startSession failed.)
Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00

The error in avrdude is:

C:\Users\dext3r>avrdude -c avrispv2 -P COM9 -p m32u4 -U hfuse:r:durp.bin

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_command(): unknown status 0xc9
avrdude: stk500v2_program_enable(): cannot get connection status
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

My guess for AVRDUDE is that I’m supposed to use stk500 as the programmer, not avrispv2 as the docs say?
Nope, same error if I use -c stk500

I have not connected the AVR programmer to any erroneous voltages or subjugated it to any weird abuse. :laughing:

Should I try to reflash the firmware for the AVR programmer?
Reflashing did not help.

Any help is appreciated. Thanks.

Hello. I am sorry you are having trouble.

Please try setting the ISP frequency to 200 kHz using the programmer’s configuration utility (not AVR Studio). Do you still get the same errors?

After a failed programming attempt, the programmer’s red LED will probably be on and you can check the programmer’s configuration utility to see what the error really was.

Have you been able to program your ATmega32U4 previously? Did you set the fuses? Could you describe how everything is hooked up, including the programmer, the AVR, and the 16 MHz clock/crystal?

–David

Hi David, thanks for the response.

As far as issues go, this seems like a weird one.
I have been programming the atmega32u4 with the factory DFU/FLIP bootloader with no issues. I need to set some fuse bits now though, and that’s why I need to use an ISP programmer.

Here is a schematic of my project:
electrifiedfoolingmachine.co/pro … ASHROM.pdf
The programmer is directly wired to the ICSP pads indicated on the schematic.

The atmega32u4 is connected to the 16 MHz clock, with the factory ‘divide by 8’ fusebit enabled, making the clock effectively 2 MHz, I think.
1/4 clock of 2 MHz is 500 kHz, so any ISP clock under 500 kHz should be good, I assume?

I have been testing this on both my home and work computers.
On home computer:
[s](Sorry if my error descriptions are a bit vague, I am at work now and don’t have access to the exact errors. I will edit this post when I get home with exact errors. Sorry!)
Setting AVR Programmer ISP clock (via Pololu utility) to 200 kHz allows AVR Studio 5.1 and AVRDUDE to both communicate with the atmega32u4!
Since I was getting a device ID and could read the fuses, I attempted to program a fuse.
Error!
AVR Studio claims to have written the fusebits, but could not verify the change (ie it never wrote it).
AVRDUDE failed at writing the fusebits, then timed out.

The Pololu config tool said something along the lines of…there was a time out.[/s]
I believe this error is because the fuse bits are locked from the factory.
DATASHEET SAYS: “Note that the Fuse bits are locked if Lock bit1 (LB1) is programmed.” and "The Lock bits can
only be erased to “1” with the Chip Erase command."

So, it seems the only way to program the fuse bits on my chip is to blow everything away, including the bootloader? If that’s true…how…lame. Regardless, that doesn’t have anything to do with the issue at hand. Because of this, I would consider the issue SOLVED on my home computer. Issue still remains on work computer.

On work computer:
Even after setting AVR Programmer to 200 kHz clock, I am still unable to obtain an device ID from the atmega32u4. I am getting the same errors as initial post.
I have set the ISP clock inside AVR Studio to the same 57.6 kHz that seemed to work back on my home computer.

Very odd how it can be sortaworking on one computer and still exhibiting the same errors on another. :question: :question:

Edit:
I have tried AVR Programmer util settings of 200 kHz, 4 kHz and 1.5 kHz with no success.
Also, I am using the same exact USB cables that used on my home computer.

I am glad you got it working on one of your computers.

These ICSP connections are incomplete. You need to connect the GND of the programmer to the ground of the board, and connect the programmer’s VDD line to VCC so the programmer can detect the target voltage. If you leave off the GND, it might work accidentally because you are probably powering the target board from USB and the USB ports on your computer probably share a common ground.

Once again, what error are you seeing in the programmer’s configuration utility on the computer that is not working?

By the way, you should try using the programmer to read the flash of your chip so that you can have the bootloader as a hex file and reprogram it later when needed.

–David

Ah - sorry about my lack of clarity. There is actually a ground and VDD pad also on the board that I have connected to. The pads are actually in the SNES PCB section of the schematic (Lower left corner). Here is the full connection: (I have no issue detecting target VDD, only programming)


Sorry, forgot to include this in my posts. Here is the error from the AVR Programmer utility:

The SPI command for entering programming mode was sent, but the expected response from the target was not received. Make sure that the ISP frequency setting is less than 1/4th of the target’s clock frequency.

:bulb: Ah, brilliant idea! Thanks for that one. :bulb:

The SPI command error you quoted usually happens because the connections between the programmer and the target AVR are incorrect, or there is something wrong with the target AVR. It is unusual for that error to happen on one computer but not another. Are you sure you didn’t change any of the components between the programmer and the target AVR when moving to the other computer?

–David

David,

Thanks for your continued support. I told ya it was going to be a weird one. :slight_smile:

I just got home, reconnected programmer and target board to my computer, works totally fine.
(Absolutely no hardware changes to the target board between work/home computer.)
AVR Studio reads Device ID of 0x1E 0x95 0x87.
I read and saved the flash as you suggested, which completed successfully.
I then erased and reflashed the file, which also completed successfully!
Turns out, this still chewed up the Atmel DFU bootloader. Oops, oh well. Don’t really care as there is the LUFA bootloader I can always use instead.

I am doubting it is a hardware (Pololu AVR programmer/my target board) issue at this point…at the same time though, the software drivers are the same between computers, so I’m not sure where the issue can lie.

They are both Windows 7 64-bit machines. Should I snoop the USB bus somehow to compare the differences between the two?
I mean, its great that I can use it at home. It would be interesting to figure out why I can’t use it on a different computer.

PROBLEM SOLVED! :smiley: :smiley: :smiley:

Unplugged programmer from USB port
I uninstalled the Pololu software/drivers via Windows control panel
Downloaded a new copy of the drivers
Installed the drivers from the fresh copy
Plugged in programmer to USB port
Open AVR Studio
Device ID read!

Very bizarre to me, but solved. Thanks for all the time and help!