32.768KHz from OC2A possible?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I've got a ATmega165p with a 32.768KHz crystal connected to the TOSC pins. The system has need for a 32.768KHz clock elsewhere, it would be nice not to provide another source.

Is it possible to configure the PWM generator for OC2A to output a 32.768KHz clock based on the timer 2 oscillator?

- kwr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Probably. It depends on your master clock frequency. An exact output can be had with 7.3728MHz crystal, for example, for both 8- and 16-bit timers according to AVRCalc.

[Weird--the exact same discussion is being held in another current thread.]

If the output does not need to be exactly 32kHz then most any master frequency can be used.

Ooops--you want to output to OC2x what is coming in on TOSC? Hmmm---maybe. But the best you'd get is clk/2 and then you couldn't really use it for other purposes.

How about trashing the 32kHz, use 7.3728MHz or other magic number, and just generate the 32kHz from there?

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately, I need a real 32KHz watch cyrstal to be there. The ATmega165 is performing RTC duty and needs to be ultra low power when the system is off (battery powered).

Too bad. Some RTCs (i.e. the one I am looking to replace) have a 32KHz clock out. Atmel - if you are listening...

- kwr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, you could still do both if the external device only needs to be alive when not sleeping.

Or, just make an external 32kHz source and drive all devices. Some inexpensive RTC chips have 32kHz out.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.