# Crystal oscillator on custom ATMega2560 board is at the wrong frequency

I have designed a custom board using an ATMega2560. The board works fine when configured to use the internal oscillator. The board stops working when I configure it to use the the external 16MHz crystal oscillator. When I place an o-scope probe at R4, the oscillator measures ~680Hz. What am I doing wrong? I even tried re-soldering the clock chip.

Here is the clock chip:

• What is the function of R3? The ATMega2560 datasheet suggests no resistor is required, and this value will damp the crystal severly. Try removing R3. Also, R4 seems to serve no purpose - the value shown is too low to have any effect. Apr 8, 2018 at 8:42
• Measure on the oscillator OUTPUT (which is buffered, low impedance, and better able to drive the load of a scope probe). Measuring on the high impedance input can kill the oscillation, which is probably what you're seeing. BUT ALSO bear in mind : digital oscilloscopes tell lies ... if yours is sampling at 16MHz + 680Hz on this timebase range, what you'll see is ... 680Hz. Apr 8, 2018 at 10:06
• @henros Your comment to remove resistors R3 and R4 was correct. Add it as an answer and I will accept it. Apr 8, 2018 at 17:04

If the XTAL2 pin is an output (as indictaed on your schematic) then R4 needs to be in series with this pin and not XTAL1 (appears to be an input on your schematic). Without a proper value of R4 in the right place you may never get oscillations to occur. See my answers here and here explaining the various components surronding a crystal that make it oscillate.

• Quote from the datasheet: "Pins XTAL1 and XTAL2 are input and output, respectively". And ATmega does not need any additional resistor to work properly. Page 11 mouser.com/ds/2/36/doc2521-41636.pdf
– G36
Apr 8, 2018 at 9:34
• @G36 that document shows pins 36 and 37 as the xtal connections so it might be that the OP is even more confused than first thought. Of cource there could be a variant that uses 33 and 34 but he could still have got them wrong. Apr 8, 2018 at 9:44
• For ATmega2560 XTAL1 is pin 34 and XTAL2 is pin 33. But as I said I never used any additional resistors with AVR. And external crystal work jus fine.
– G36
Apr 8, 2018 at 9:54
• @Andyaka I have removed the resistors per the datasheet and bridged the connection across R4. The output still looks the same. Apr 8, 2018 at 16:39
• Good man - maybe you should consider leaving an answer to that effect explaining where things went wrong and how you solved it. Doesn't have to be long and someone, somewhere might just appreciate it. Apr 8, 2018 at 17:59

As posted in other responses, I had to remove R3 and R4, but I also had to burn different fuse setting using the following avrdude command

avrdude -c usbasp -p atmega2560 -C ../etc/avrdude.conf -U lfuse:w:0xff:m -U hfuse:w:0x99:m -U efuse:w:0xff:m

Fuse setting can be calculated here