16Mhz crystal problem

Hello, I'm trying to follow this (http://arduino.cc/en/Tutorial/ArduinoToBreadboard) tutorial to burn an arduino bootloader onto an atmega328P-PU. I have everything wired up correctly except that the crystal I bought is not a 2pin one that they show here. I got this one that has 4 pins: http://www.mouser.com/ProductDetail/ABRACON/ACH-16000MHZ-EK/?qs=sGAEpiMZZMukHu%252bjC5l7YUoOOqNWuemba6bKJBfe2DA%3d here is the data sheet: http://www.abracon.com/Oscillators/ach.pdf so i grounded and powered the pins on the crystal that say need that but then I don't know what to do with the other ones. I have tried them both pins in both pins of the atmega (pins 9 and 10) and I still can't get the bootloader to burn. any ideas what I'm doing wrong? I have the correct board and COM ports chosen and everything in my software. is this just the wrong crystal? these are the error messages: avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

in case you want to see...here is the set up: http://dl.dropbox.com/u/7072449/2011-06-20%2018.29.10.jpg Thanks for any help!

Your not the first to make that mistake. The standard arduino design is to use a 2 pin 16Mhz crystal RESONATOR wired to the XTAL1 and XTAL2 pins on the processor chip, along with two 22pf capacitors. In this setup the crystal's oscillator circuit is built into the processor and this internal oscillator activated by the fuse settings for the chip.

What you purchased is a crystal OSCILLATOR module. It has both a built in crystal resonator and the oscillator circuit and outputs a TTL voltage 16Mhz clock signal.

Now the processor can utilize this kind of clock module. One would wire the crystal module as follows, pin 2 to ground, pin 5 to processor pin 9 and pin 8 to +5vdc, pin 1 is a no connection. However the difficult part is that the processors fuses should then be changed to accept this TTL clock signal input to CKSEL = 0000. Changing fuse settings is a more complex procedure.

Your probably better off just getting the proper 2 pin 16Mhz crystal resonator, they are cheap:

http://www.sparkfun.com/products/536

For breadboad setups I like to use the 3 pin ceramic resonators as it has the padding capacitors built in saving you from having to use the two 22pf external caps that the crystal resonator requires:

http://www.sparkfun.com/products/9420

Lefty

thanks for your help lefty...grrr..a previous order with sparkFun JUST shipped out...time to wait another week to start my project :-(

i just tried the example to use the 8Mhz internal clock...still getting the same error...i have the right board selected, too...the one with the breadboard...wired everything up just like the xample at the bottom http://arduino.cc/en/Tutorial/ArduinoToBreadboard

avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

any ideas?

any ideas?

That would only work if you change the processors fuse settings to utilize the internal 8Mhz clock source. I suspect you didn't do that yet and as I said changing fuse settings is an advance topic requiring proper programmer and software, no way to do it inside the Arduino IDE by itself.

Lefty

thanks so much for the help...i did do these steps (still to no avail):

1.Download this hardware configuration archive: breadboard.zip 2.Create a "hardware" sub-folder in your Arduino sketchbook folder (whose location you can find in the Arduino preferences dialog). If you've previously installed support for additional hardware configuration, you may already have a "hardware" folder in your sketchbook. 3.Move the "breadboard" folder from the zip archive to the "hardware" sub-folder of your Arduino sketchbook. Restart the Arduino software. 4.You should see "ATmega328 on a breadboard (8 MHz internal clock)" in the Tools > Board menu.

this is what's on the .txt file:

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500 atmega328bb.upload.maximum_size=30720 atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2 atmega328bb.bootloader.high_fuses=0xD9 atmega328bb.bootloader.extended_fuses=0x07 atmega328bb.bootloader.path=arduino:atmega atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex atmega328bb.bootloader.unlock_bits=0x3F atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p atmega328bb.build.f_cpu=8000000L atmega328bb.build.core=arduino:arduino

I have the correct board and COM ports chosen and everything in my software. is this just the wrong crystal? these are the error messages: avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

This is usually an error associated with uploading of a sketch rather than with burning the bootloader. What programmer are you using?

i'm just using a duemilanova with the original atmega in it to try, via usb and the arduino gui, to program an atmega328p-pu on a breadboard...i feel like there might be some step i'm missing that's not on the tutorial page...? i followed everything on that tutorial....any other ideas? Thanks for any help!

That explains it. The error tells you that your Arduino does not talk to the computer. Are you able to upload any sketch at all?

yeah i can upload normal sketches fine...the tutorial says that you can use your pc (win7 x64) to do this... has anyone actually done this? any advice?

So what sketch are you trying to upload that burns the bootloader onto another ATmega328? What instructions are you following?

the instructions i specified at the top of the post (http://arduino.cc/en/Tutorial/ArduinoToBreadboard)...i'm going into tools ---> burn bootloader ---> arduino as isp also i tried the arduino isp sketch in the examples and that got the same error...but i can upload the blink sketch just fine...

It is still not clear when you get the error: 1. in step 1, where you upload the ArduinoISP sketch onto your Arduino? or 2. in step 2, where you are actually burning the bootloader (by running the previously uploaded ArduinoISP sketch)?

ok so i am able to upload the arduinoISP sketch in the examples...but now when i upload arduino as ISP in tools/burn bootloader i get a weird error: (and i selected the new, proper 8mhz board)

avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

Google-ing it for you, I got this: http://www.arduino.cc/en/Guide/Troubleshooting#toc23 among many other links. Can you get (does it tell you) the expected signature?

You are likely being bit by the chicken-and-egg problem around the fuse bits. Basically you need a valid clock or crystal to use the ICSP to write the d*mn bits! But of course if you HAD the crystal you would not need to change the bits! GRR… bites me all the time when I first build up a board. The chips are shipped using the internal (SLOW) clock. The board works fine but then I write the fuse bits to switch to an external crystal and it goes dead. The only thing you can do at that point is fix the external crystal! :frowning: [Or actually I think that there is a high voltage parallel programming mode that I’ve never heard of anyone actually using but it is in the spec]

Cheers!
Andrew

If you're starting fresh, brand new chip, the chip uses the internal timing so you should be able to talk to it with your average ISP type programming device. There is a way to use an Arduino as and ISP programmer as someone has already eluded to, or you can use a device like ATAVRISP2.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=ATAVRISP2-ND

However, after you burn your fuse bits, because you're burning the fuse bits to now look for an external timing device, if your crystal isn't working you will have a dead chip until you get one that works with the microcontroller.

Setting the proper fuse bits for the crystal can be tricky as you need to follow the datasheet and application notes instructions. I think I have noticed even the official arduino bootloader fuse bits aren't correct in some of the 16Mhz variants as the datasheet states you need the fuse bit set to 'full swing' for 16MHz and higher. I previously worked for a company who's engineers made a similar mistake and it was a pain to troubleshoot the reasons for the stability issues.

The easiest way to choose a crystal and get your cap values right is to follow a known working bill of materials, the arduino community is great about publishing these.