Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

ATMega168: configuring fuses?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ATMega168: configuring fuses?

by toaste on Wed Mar 12, 2008 2:38 pm

I'm trying to set up a breadboard for an atmega168 similar to http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard

Unfortunately, I don't think my clock is correct, since I keep getting out-of-sync errors loading code to it over a usb-ttl cable, and the fast LED blink I'm supposed to see on digital 13 on reset is a bit slow.

I had to program the bootloader, and I don't know if just burning the hex file sets the correct fuses. I used a universal programmer in the university lab to burn the arduino ng hex file and verify it, but took no other steps.

Attaching probes to xtal1 and xtal2 only shows some 60hz noise, so my ceramic oscillator is either fried or not being used.

What do I need to do to verify that the fuses are set correctly, or to set them if they aren't?
toaste
 
Posts: 8
Joined: Wed Mar 12, 2008 1:47 pm

by mtbf0 on Wed Mar 12, 2008 8:58 pm

you'll have to burn the fuses yourself.
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Help! Still no luck setting up fresh atmega168

by toaste on Tue Mar 25, 2008 6:31 pm

Still trying to set up a factory fresh atmega168, but having no luck communicating with it even after configuring the fuses and burning the arduino NG bootloader.

The good news is that fuse configuration on my programmer does *something* -- it's apparently using the external oscillator now (the bootloader's 3 blinks are now quite quick). It repeats the blinks every 10 seconds or so.

The bad news is I still can't load a sketch. I get a not in sync error when trying to upload. I've tried hitting upload immediately before and after resetting with no luck, and tried tying the cable ground to board ground with only a slightly different result:

Cable ground not tied to board:
Code: Select all | TOGGLE FULL SIZE
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Cable ground tied to board ground:
Code: Select all | TOGGLE FULL SIZE
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51


The question is, am I still missing something here? Did I get the fuses right? The board? The problem is it all looks okay to me at this point, so maybe more eyes will help.

Photo of the breadboard layout:
(the orange/yellow wires in the cable actually are connected to the orange/yellow wires on the board, the angle is just funny)
Image


And the fuse configuration dialog:
Image
toaste
 
Posts: 8
Joined: Wed Mar 12, 2008 1:47 pm

by trialex on Tue Mar 25, 2008 6:41 pm

What version of Arduino software are you using? Make sure you have the right board selected for the bootloader that you burned.

If your oscillator isn't osciallating it won't burn either.
trialex
 
Posts: 189
Joined: Mon Apr 03, 2006 6:25 pm

by adafruit on Tue Mar 25, 2008 6:43 pm

dont forget, you have to connect ground from the ftdi cable to the ground of the arduino!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by toaste on Tue Mar 25, 2008 10:07 pm

I'm using version 0010 and select "Arduino NG or older w/ATmega168".

I've tried connecting cable ground to board ground without any effect.

I'll check the oscillator out as soon as I can get by the lab (probably this evening).

EDIT: Fixed! I did manage to set the fuese correctly, but I forgot that TXD and RXD are relative to each device (TXD on device 1 goes to RXD on device 2 and visa versa).

Image
toaste
 
Posts: 8
Joined: Wed Mar 12, 2008 1:47 pm

by aredhel on Fri Mar 28, 2008 2:15 pm

It all so looks like you are missing decoupling capacitors. Well, the power buses on you breadboard may be acting as capacitors for you, the odds are, as soon as you start trying to do real work with your chip you will start to get brownouts. Putting a 0.1uF ceramic capacitor across pins 7 and 8 is really needed. Putting another one across pins 22 and 20 is also a good idea if you are going to be doing any A to D work.

-Aredhel

aredhel
 
Posts: 5
Joined: Wed Jan 16, 2008 7:10 pm

by toaste on Sat Mar 29, 2008 3:08 am

Thanks for the tip, but the ceramic oscillator I'm using includes internal load capacitors so extra decoupling capacitance is unnecessary.
toaste
 
Posts: 8
Joined: Wed Mar 12, 2008 1:47 pm

by trialex on Sat Mar 29, 2008 9:10 pm

That's not what decoupling capacitors are for. You need them to filter out spikes and dips in the power supply. They go between the +ve and -ve rails, nothing to do with the crystal/resonator - they are used for a different reason.
trialex
 
Posts: 189
Joined: Mon Apr 03, 2006 6:25 pm

by toaste on Sun Mar 30, 2008 3:10 pm

Sorry for misunderstanding -- This breadboard happens to be attached to a decent power supply so I hadn't been paying attention to where my power came from so much.

I've since moved to a power supply I implemented on the other side of the breadboard. I expect some noise on the input so I have a 100uF cap across the input voltage and ground. I have also added decoupling caps across the power supply pins (7-8) and another across the analog reference voltage (22-20) as you recommended.
toaste
 
Posts: 8
Joined: Wed Mar 12, 2008 1:47 pm

Please be positive and constructive with your questions and comments.