Author Topic: AB18X5 RTC instead of TPL5010  (Read 11972 times)

Uncle Buzz

  • Full Member
  • ***
  • Posts: 146
  • Country: fr
AB18X5 RTC instead of TPL5010
« on: January 18, 2021, 07:13:31 AM »
Hi,

I would like to use the AB1805 like we use TPL5010, with a configurable period unlike the TPL5010, but I'm not sure we can configure the watchdog of the AB1805 like the one of TPL5010 :
I would like to set a time interval with an interrupt to wake up the microcontroller, and simultaneously start a timeout counter for the watchdog, waiting for the WDI input controlled by the microcontroller to stop the watchdog before the timeout, or active the reset output if timeout.

To my mind, the documentation is not clear how the watchdog is working. Is this TPL5010 scenario reproducible? From the AM18X5 Datasheet who is a clone, what I understand is that the watchdog timer is an independent function and is automatically restart after a timeout or a change in the level of the WDI pin. Is it possible to synchronize the interrupt timer function and the watchdog timer?

Has anyone used this RTC this way?

I also would like to use the internal RC oscillator of the microcontroller at 8MHz, and use the clockout output of AB1805 at 32.768kHz as an asynchronous external clock, at least to be able to calibrate the internal 8MHz oscillator. Is there any inconvenience to do this for lower consumption? Is it achievable? I saw I can use the internal 8MHz oscillator with an external 32.768KHz crystal in asynchronous mode, or an external clock signal in synchronous mode, but can I use the internal 8MHz oscillator with an external 32.768KHz clock signal in asynchronous mode?  (this question is specific to ATMEGA328p and 1284p)

EDIT:
Quote
18.11.8 ASSR – Asynchronous Status Register
Bit 6 – EXCLK: Enable External Clock Input
When EXCLK is written to one, and asynchronous clock is selected, the external clock input buffer is enabled and an external clock can be input on Timer Oscillator 1 (TOSC1) pin instead of a 32kHz crystal. Writing to EXCLK should be done before asynchronous operation is selected. Note that the crystal Oscillator will only run when this bit is zero.
If I'm not wrong, this ATMEGA datasheet extract means I can use an external clock in asynchronous mode from the RTC clock output, isn't it?
« Last Edit: January 18, 2021, 07:46:31 AM by Uncle Buzz »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: AB18X5 RTC instead of TPL5010
« Reply #1 on: January 28, 2021, 10:32:00 PM »
I've used the Alarm registers in the AB1805 as a 'periodic' timer by simply adding a new alarm value that is T+timeout.  I've used the Watchdog function, but I don't recall how at the moment.  If it comes to me I'll let you know.  Note that this is actually more flexible than the TPL5010 in that the TPL5010 Wake is fixed intervals from the moment it is powered up.  The Done pulse timing has no affect on when Wake occurs (unless you miss it, of course).

You should bear in mind that the 32768KHz clock in the AB1805 actually runs faster than 32768KHz.  The AB1805 has internal registers that dither that clock by some funky ratios to yield a fairly accurate time (once it's calibrated) to +/-2PPM.  But the clock itself is fast, so feeding into another device will be correspondingly fast.  I don't recall how much faster it was, but it wasn't trivial.  Might have been between 100-200PPM, but I won't attest to that.

Uncle Buzz

  • Full Member
  • ***
  • Posts: 146
  • Country: fr
Re: AB18X5 RTC instead of TPL5010
« Reply #2 on: January 29, 2021, 07:55:01 AM »
From what I understand from the datasheet, it's not possible to "copy" the workflow of the TPL5010... The watchdog has no link with date or other timer counter and its maximum period is far smaller (4s*31 ~ 2mn) than what other counters permit. The watchdog has no interrupt, it's only a timeout counter who can't wake up our node, it just checks if the node is still alive, if the node doesn't set WDI before the end of the watchdog timer, the AB1805 will reset the node, but you have to wake up your node yourself from another way.

The TPL5010 watchdog is far better! AB1805 is only a good choice for a not constant period or a known date to wake up, but with the lack of the watchdog function.

And from what you said, it needs to be calibrated if we care about time precision.

There are still some windows where it's a useful replacement of the TPL5010, but not as great as we might first think.

Uncle Buzz

  • Full Member
  • ***
  • Posts: 146
  • Country: fr
Re: AB18X5 RTC instead of TPL5010
« Reply #3 on: February 15, 2021, 03:47:50 AM »
You should bear in mind that the 32768KHz clock in the AB1805 actually runs faster than 32768KHz.

Hi Tom, just to be sure I understand correctly, you told me about the 32768KHz clock, it's just the external clock output, the Real-Time Counter is not impacted and it's more accurate by default or the default 32768KHz clock is set faster for all functions, external clock signal as RTC?

EDIT : how could we calibrate the RTC 32768KHz clock with the help of the external RFM69 clock activated on DIO5? Would it be a good way to auto-calibrate it on each node, or is it a bad idea?
« Last Edit: February 15, 2021, 11:22:24 AM by Uncle Buzz »