ATTINY 1614 RTC External Oscillator - liberate PB2/TOSC2 ?

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

Hi - I'm using the RTC in an ATTINY 1614 with an external 32.768kHz oscillator on PB3/TOSC1 (oscillator, not a crystal). I want to use PB2/TOSC2 as a GPIO (input). It appears that when the RTC is configured for external 32kHz crystal or oscillator input on TOSC1, the PB2/TOSC pin cannot be reprogrammed as a GPIO ? Can anyone confirm this, or, hopefully, describe how the pin can be reprogrammed to be used as a GPIO (I need a pollable input/pullup on this pin...).

 

The RTC works as required in all other respects, it just seems you have to commit both TOSCn pins when you enable external 32kHz mode, whether you're using a crystal or an oscillator?

 

Thanks -

 

Mark

 

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

If you don't need an oscillator, you can set it like this.
PB2 is released from the curse of TOSC.

    CLKCTRL.XOSC32KCTRLA = CLKCTRL_SEL_bm;

All you have to do now is check if the clock from the external oscillator is normally supplied to the RTC.

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

kabasan - many thanks! I looked everywhere else for the solution (RTC, GPIO, PORTMUX...) but didn't look at CLKCTRL <smack> !!!

 

I will test this out tomorrow! Thanks so much for the fast and complete insight!!!

 

Cheers -

 

Mark

 

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

kabasan - of course this works just as you said - thanks again! PB2 has indeed been released from the curse of TOSC!!!!

 

Mark