Programming UNO (ATMega328P) from Atmel Studio

Hey guys

I've bought a programmer, the Pololu USB AVR Programmer (http://www.pololu.com/catalog/product/1300).

I'm trying to program the 328p mcu in Atmel studio using this device, but I'm running into a lot of problems. When creating a new project, I chose to create a standard C application. I've also added the STK500 as an available tool. The Uno board is powered from a 12V plug, and not connected by USB, but the problems I'll describe occurred when powering it from USB aswell.

However, when pressing F5 to compile & run (A blank program, just a start template basically), I get an error message "Launch has failed and Studio could not read target voltage. Please check your connections and try again."

Strange thing is, when viewing the available tools in Atmel Studio, the programmer can read voltages/fuse bits/lock bits/device signature without problems. The configuration utility from Pololu also does not display any errors from the last programming attempt.

I've tried to check the programmer's manual, and the blinking red LED on the board indicates a problem, but none of the proposed solutions have worked for me. What could I still be doing wrong?

Thanks again, in advance.

I believe "AVRISP" (instead of "STK500") is the correct choice. Nope... Pololu - 3.b. Programming AVRs using Atmel Studio

Hello Coding Badly

Care to elaborate?

Are you referring to an AVRISP programmer (such as the Mk-ii)? The atmega328p is not on the mk-ii's list of supported devices (officially).

This is the entry I use to integrate the Pololu AVR Programmer with the Arduino IDE...

avrispv2.name=AVR ISP v2 (Pololu)
avrispv2.communication=serial
avrispv2.protocol=avrispv2

These are some example command-line invocations of avrdude using the Pololu AVR Programmer...

avrdude -v -v -v -pattiny85 -cavrispv2 -P\\.\COM8

avrdude -v -v -v -pattiny85 -cavrispv2 -P\\.\COM8 -e -Uefuse:w:0xFF:m -Uhfuse:w:0xD7:m -Ulfuse:w:0xE2:m

avrdude -v -v -v -pattiny85 -cavrispv2 -P\\.\COM8 -e -Ulock:r:Junk.txt:m

I assumed "AVRISP" (should have been "AVRISPV2") was the correct choice for Atmel Studio but the Pololu documentation clearly states "STK500" is the correct choice.

Thank you!

I changed the lines in programmers.txt, now I can program the device using the arduino ide (it should work with visual studio as well, I've been using it with the visual micro plugin for the last couple of weeks).

Now to figure out what's up with Atmel studio ... >.>

Anyways, thanks for the help again Coding Badly :slight_smile:

The IDE does give a few errors:

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_recv(): buffer too small, received 32 byte into 32 byte buffer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_recv(): buffer too small, received 32 byte into 32 byte buffer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_recv(): buffer too small, received 32 byte into 32 byte buffer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_recv(): buffer too small, received 32 byte into 32 byte buffer
avrdude: verification error, first mismatch at byte 0x0000
         0x0c != 0x00
avrdude: verification error; content mismatch

But the test program works fine (simple blinking LED).

You are welcome. Enjoy your new programmer!

Just an update;

To get the programmer to work in Atmel Studio 6, after adding the programmer tool you have to navigate to the Device Programming window (in the toolbar).

In there you can go to memories and specify the hex file to upload onto the MCU (the file is in your project directory).

Worked perfectly for me, able to program with Atmel Studio now (happiness :P).

There are quite a few standalone avr programmers that can watch your code for changes and program the chip automatically. They require no human intervention once they are set-up.