Loading...
Pages: [1]   Go Down
Author Topic: Programming an ATMEGA168 with an Arduino Uno r3  (Read 503 times)
0 Members and 1 Guest are viewing this topic.
Montpellier
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As from title, I am trying to program an ATMEGA168 with my Arduino Uno.

I have found several tutorials on the net with all sorts of different details... but none really seems to work for me.

What I have done for now is:

1) Upload the Arduino as ISP sketch on the board
2) Wire the ATMEGA as suggested by this site: http://blog.biophysengr.net/2012/06/writing-sketches-to-atmega386p-pre.html

Pin 1 to Arduino reset pin, through a 10K resistor, with a 22uF capacitor to avoid automatic resetting of the board
Pin 7 and 20 to 5V
Pin 8 and 22 to GND
Pin 9 and 10 connected to a 16MHz crystal with a 22pF capacitor on each end

Arduino pin 10 to ATMEGA Pin 1
Arduino pin 11, 12, and 13 to ATMEGA Pin 17, 18, and 19 respectively

Like this:


3) Now I open a sketch, for instance the Blink example (I added a LED to pin 19 of the ATMEGA in order to test if it is working), select "Arduino as ISP" as programmer from the Tool menu and upload the sketch.

I get a "Done uploading" message, with this error:
avrdude: stk500_getsync(): not in sync: resp=0xe0

Needless to say, the LED does not blink...

I am fairly new to all of this, so any solution or even hint would be much appreciated.
Logged

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


The blue wire connecting the programmer's RESET to the target's RESET is wrong.  Remove it.

The capacitor is connected between RESET and GND only on the programmer (your Uno).
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your use of colour is very confusing. Normally red is for +5V and black is for Gnd. You have them backwards.

Here is my setup:



And to program:

Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 279
Posts: 15314
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Your use of colour is very confusing. Normally red is for +5V and black is for Gnd. You have them backwards.

Boy what a stick in the mud conventionalist you have become.  smiley-wink

 Free your mind, let the colours express themselves in their operation not their appearance I say.  smiley-grin

Lefty
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There is no spoon colour.
Logged


Montpellier
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Really? I'm fairly new to this, always thought it was the other way around... don't know why, but it doesn't really matter, at least I'm consistent!

Anyway, back to the question. First of all thanks for spotting the wrong connection, not sure why I put that... I guess that was the result of too much thinkering...

So I don't need to add the clock when programming the ATMEGA or it was just not in your photos for other reasons?

Thanks for taking the time to help a noob smiley
« Last Edit: February 17, 2013, 01:36:10 pm by Nico80 » Logged

Montpellier
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In any case, with or without crystal the sketch always gets uploaded to the Arduino and not on the ATMEGA168, even if I choose "Arduino as ISP" as a programmer.

This site http://www.open-electronics.org/arduino-isp-in-system-programming-and-stand-alone-circuits/ suggests adding a new entry in the boards.txt file, I am trying to do that but with not much success, as I continue to get this error:

Code:
avrdude: Yikes!  Invalid device signature.

Any ideas?
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13896
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you selecting "Upload Using Programmer" not just "Upload"?
Logged


Pages: [1]   Go Up
Print
 
Jump to: