0
\$\begingroup\$

If i want use a watch crystal(32KHz) with Low Frequency Crystal Oscillator of ATmega328p,Which pin should i connect the crystal to?

Should i connect the crystal to XTAL1,XTAL2 pins of ATmega328p

or

Should i connect the crystal to TOSC1,TOSC2 pins of ATmega328p

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

The XTAL pins are also the TOSC pins, so you really don't have an option to go wrong here.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Are you saying that XTAL pins and TOSC pins are internally connected and i can connect the crystal to either XTAL pins or TOSC pins to use the LOW Frequency Crystal Oscillator \$\endgroup\$ – Rahul.In Apr 10 '19 at 5:07
  • \$\begingroup\$ Just look at the MCU pins on datasheet. You will find that TOSC pins are same as XTAL pins. \$\endgroup\$ – Justme Apr 10 '19 at 8:16
0
\$\begingroup\$

A 32.768 kHz crystal is a crystal and needs to be connected to the "Low-frequency crystal Oscillator" which is connected to the TOSC1 and TOSC2 pins.

Which are the same pins as the XTAL1 and XTAL2 pins!

Are you confused yet?

The function of these pins is defined by the settings defined by the clock selection fuses. These are discussed in section 6.2 of the datasheet.

So you might have to (re)program the "fuses" to allow the 32 kHz crystal to be used.

Also realize that at a 32 kHz clock the MCU will operate quite slowly.

If you want to make a clock using an MCU, consider a dedicated RTC (Real Time clock) module like the DS1307.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Also of note, you can dynamically change the clock settings in code when the MCU boots rather than burning fuses. If the MCU is being clocked externally at such a low speed, you will also likely have to add a -B 1024 option to AVRDUDE programming commands to change the communication bitrate. \$\endgroup\$ – Kurt E. Clothier Jan 23 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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