|
catalogue search
|
You may also be interested in
PCI, Wireless LAN controller, Evaluation kit, Development kit, Controller module
Text version of the page
12.3 Wakeup TimersTwo 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 usingvAHI_WakeTimerEnable()before loading the count value for the period. The count value is loaded usingvAHI_WakeTimerStart()and causes the counter to begin to count down to zero; the counter can be stopped at any time usingvAHI_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 theu8AHI_WakeTimerStatus()function, which indicates if the timers are running. The timers can be checked to see if they have expired usingu8AHI_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 CalibrationThe 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 callingu32AHI_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 |