Pages: [1]   Go Down
Author Topic: Programming UNO (ATMega328P) from Atmel Studio  (Read 1008 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I believe "AVRISP" (instead of "STK500") is the correct choice.  Nope... http://www.pololu.com/docs/0J36/3.b
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Code:
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...

Code:
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

The IDE does give a few errors:

Code:
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).
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


You are welcome.  Enjoy your new programmer!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-razz).
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: