4
\$\begingroup\$

I'm having a hard time figuring out why after attaching 22pF load caps to a 16 Mhz crystal on atmega328p my whole project (aka flashing leds) does not work. Once i remove the load caps everything works correctly (the leds flash faster ~), and avrdude detects the atmega. I'm using avrdude -P usb -c usbtiny -p m328p -U lfuse:w:0xE6:m to enable the crystal.

I'm following the atmega spec documentation (section 8.3).

\$\endgroup\$
3
  • \$\begingroup\$ Check the datasheet for the crystal, 22pF may be too much for some crystals \$\endgroup\$ Commented Aug 11, 2012 at 20:36
  • 2
    \$\begingroup\$ I use 22pF caps with a 16MHz crystal on the ATMega328 all the time without a hitch... it's probably something about the particular crystal you've chosen - datasheet or it didn't happen \$\endgroup\$
    – vicatcu
    Commented Aug 11, 2012 at 21:51
  • 1
    \$\begingroup\$ We need the crystal part number/datasheet as mentioned. Also, if you are using a breadboard, a picture of the crystal placement might help. Make absolutely sure the caps are really 22pF (are they marked 220 or 22J or similar?) \$\endgroup\$
    – Oli Glaser
    Commented Aug 11, 2012 at 22:01

2 Answers 2

2
\$\begingroup\$

Crystals are rated to drive some expected amount of capacitive load. Your wiring and the internals of the microcontroller will also add their own load. That, plus the load caps you add, need to be in the right range for the crystal, otherwise the oscillator won't start properly.

You could try smaller caps. If you're in a breadboard, the breadboard itself will already add a bit of capacitance.

\$\endgroup\$
0
\$\begingroup\$

Check the quality of the caps. From what I've read, ceramic caps come in all sorts of flavors and qualities, and you should get caps that are designed for use with crystals.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.