IEEE802.15.4 / ZigBee Wireless MicrocontrollersR - Jennic - #39

/ 78


catalogue search
P. 01
P. 02
P. 03
P. 04
P. 05
P. 06
P. 07
P. 08
P. 09
P. 10
P. 11
P. 12
P. 13
P. 14
P. 15
P. 16
P. 17
P. 18
P. 19
P. 20
P. 21
P. 22
P. 23
P. 24
P. 25
P. 26
P. 27
P. 28
P. 29
P. 30
P. 31
P. 32
P. 33
P. 34
P. 35
P. 36
P. 37
P. 38
P. 39
P. 40
P. 41
P. 42
P. 43
P. 44
P. 45
P. 46
P. 47
P. 48
P. 49
P. 50


See other catalogues for Jennic

Text version of the page

12.3 Wakeup Timers

Two 32-bit wakeup timers are available in the JN5121 driven from the 32kHz internal clock. They continue to run during sleep periods when the majority of the rest of the device is powered down. The wakeup timers do not run during deep sleep. They are intended to be used in timing sleep periods or other long period timings that may be required by the application. When a wakeup timer expires it typically generates an interrupt which, if the device is asleep may be used as an event to end the sleep period. See Section 16 for further details on how they are used during sleep periods. Feature include:

32-bit down-counter

Runs during sleep periods

Clocked from 32 kHz RC oscillator A wakeup timer consists of a 32-bit down counter clocked from the 32 kHz internal clock. An interrupt or wakeup event can be generated when the counter reaches zero. On reaching zero the counter will continue to count down until stopped, which allows the latency in responding to the interrupt to be measured. If an interrupt or wakeup event is required, the timer interrupt should be enabled using

vAHI_WakeTimerEnable()

before loading the count value for the period. The count value is loaded using

vAHI_WakeTimerStart()

and causes the counter to begin to count down to zero; the counter can be stopped at any time using

vAHI_WakeTimerStop()

. The counter will remain at the value it contained when the timer was stopped and no interrupt will be generated. The status of the timers can be checked using the

u8AHI_WakeTimerStatus()

function, which indicates if the timers are running. The timers can be checked to see if they have expired using

u8AHI_WakeTimerFiredStatus()

which is useful when the timer interrupts are masked. If a timer has expired the fired status will be reset by the function.

12.3.1 RC Oscillator Calibration

The RC oscillator used to time sleep periods is designed to require very little power to operate and be self-contained, requiring no external timing components and hence is lower cost. As a consequence of using on-chip resistors and capacitors, the inherent absolute accuracy and temperature coefficient is lower than that of a crystal oscillator, but once calibrated the accuracy approaches that of a crystal oscillator. Sleep time periods should be as close to the desired time as possible in order to allow the device to wake up in time for important events, for example beacon transmissions in the IEEE802.15.4 protocol. If the sleep time is accurate the device can be programmed to wake up very close to the calculated time of the event and so keep current consumption to a minimum. If the sleep time is less accurate, it will be necessary to wake up earlier in order to be certain the event will be captured. If the device wakes earlier, it will be awake for longer and so reduce battery life. In order to allow sleep time periods to be as close to the desired length as possible, the true frequency of the RC oscillator needs to be determined to better than the initial 30% accuracy. The calibration factor can then be used to calculate the true number of nominal 32kHz periods needed to make up a particular sleep time. A calibration reference timer, clocked from the crystal oscillator, is provided to allow comparisons to be made between the RC clock and the 16MHz crystal oscillator when the JN5121 is awake. Operation is as follows:

Wakeup timer0 is disabled and programmed with a number of 32kHz ticks

Calibration mode is enabled which causes the Calibration Reference counter to be zeroed. Both counters start counting, the wakeup timer decrementing and the calibration counter incrementing

When the wakeup timer reaches zero the Reference Counter is stopped, allowing software to read the number of 16MHz clock ticks generated during the time represented by the number of 32kHz ticks programmed in the wakeup timer. The true period of the 32kHz clock can thus be determined and used when programming a wakeup timer to achieve a better accuracy and hence more accurate sleep periods The RC oscillator has a good temperature coefficient for an oscillator of its class, see section 17.3.5. However this should be taken into account, for a given application, when planning the wake up events and the time interval between calibrations. A calibration can be performed by calling

u32AHI_WakeTimerCalibrate(),

which calibrates over twenty 32kHz ticks and returns the number of 16MHz ticks recorded. For a RC oscillator running at exactly 32kHz the value returned should be 10000. If the oscillator is running faster than 32kHz the count will be less than 10000, if running slower the value will be higher. For a calibration count of 9000, indicating that the RC oscillator period is running at approximately 35kHz, to time for a period of 2 seconds the timer should be loaded with 71,112 ((10000/9000) * (32000*2)) rather than 64000. 34 JN-DS-JN5121 v1.8 © Jennic 2007 Preliminary

pageCatalog pdf di En 2012-05-22-30