32.768KHz interrupts on SAM C21N

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

Hi all.

 

I'm new to ARM M0+ and it's a bit of a learning curve. I'm using the ATSAM C21N18A-ANT based SAM C21N Xplained Pro eval board.

 

I'd like to generate interrupts at 32.768KHz (to, let's say, toggle a few LEDs). I have configured OSC32KCTRL to operate with an external crystal and can see the operating 32K clock by sending it to a GCLK_IO pin.

 

The only interrupt sources in OSC32KCTRL are XOSC32KRDY, CLKFAIL and OSC32KRDY.  GCLK has no interrupts so I can't use it to generate interrupts with XOSC32K as the source. I'm thinking my only option to connect GCLK to some other peripheral to generate the interrupt. Would that be right? And if so which one?

 

TIA.

Lisican.

Last Edited: Fri. Mar 25, 2022 - 04:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd like to generate interrupts at 32.768KHz

32kHz is "quite often" for a 48MHz CPU, IMO.  (not completely impossible, but ... not advisable.)

 

I'm thinking my only option to connect GCLK to some other peripheral to generate the interrupt. Would that be right? And if so which one?

The "Periodic Interval" feature of the RTC peripheral is aimed at this sort of application.  I think on SAMC it interrupts at a maximum frequency of 32768/8 (4096 Hz.)  Other power-of-two divisors are available.  Note that AFAIK, the "periodic Interval" function is independent of the counter/clock feature itself, so you can still configure it as a clock/calendar with alarms and stuff, as well as getting periodic interrupts.

 

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

Thanks for responding.

 

Yes I did see the RTC periodic interval but unfortunately not available for a divisor of 1/1.

 

I know 32kHz  is "often" - this was more an academic question than a real-world need. I'm just playing with the dev board, trying to get comfortable.