Using the pololu USB AVR programmer on an ATMega16u2


I’m working on a project which involves using the ArduinoMega2560 rev3 as a USB keyboard.

I’m using the USB AVR programmer for two ISP tasks:

  • sending sketch files to the ATmega2560 (done, thanks in great part to other posts on the forum and … s-new.html)

  • writing a LUFA inspired code to the ATMega16u2, to get it recognized as an USB keyboard.

I’m having problems with that part.

I connected the USB AVR programmer to the Atmega16u2 ISP pins
I’m using AVR Studio 4. Project Type is AVRGCC, Debug platform AVR Simulator, Device type ATMega16u2.

I’m connecting with the AVRISP platform, until there no problem.

When I try to read the device signature, trying to match with the AT90USB162 signature, or any other actions from the “STK500 in ISP mode with AT90USB162” window, the connection fails when entering programming mode (I set the frequency at 1,21KHz to be sure to stay in range)

I checked the troubleshoot section but the connection seems to work between the programmer and the target, as the yellow led is blinking before i try to read the target’s signature. Could it be a problem with the lock bits being set ? (i can’t check that as the connection fails if i open the lock bits tab)

So :

  • is the ATmega16u2 supported ?
  • if so, are there specific parameters that I missed ?

thanks for your help,

Hello, Julien.

We haven’t tested the Pololu USB AVR Programmer with an ATmega16u2 but that chip does have the AVR ISP interface, so it should work. It sounds like you haven’t selected the right device in the STK500 dialog box. Try selecting “ATmega16U2” in the dropdown box in the Main tab.

Also, please note that the frequencies listed in AVR Studio do not match the actual frequencies used by our programmer so you might want to use the Pololu USB AVR Programmer Configuration Utility to set the frequency. There is more info in the “Configuring the Programmer” section of the Pololu USB AVR Programmer User’s Guide.