Watchdog driver implementation for Low Power F3 devices.
The Watchdog header file should be included in an application as follows:
Refer to Watchdog.h for a complete description of APIs.
The general Watchdog API should be used in application code, i.e. Watchdog_open() should be used instead of WatchdogLPF3_open(). The board file will define the device specific config, and casting in the general API will ensure that the correct device specific functions are called.
This Watchdog driver implementation is designed to operate on a CC23X0 device. Before using the Watchdog on CC23X0, the Watchdog driver is initialized by calling Watchdog_init(). The Watchdog HW is configured by calling Watchdog_open(). Once opened, the Watchdog will count down from the reload value specified in WatchdogLPF3_HWAttrs. If it times out, a reset signal will be generated. To prevent a reset, Watchdog_clear() must be called to reload the timer.
The Watchdog counts down at the rate of the device clock LFCLK. The watchdog driver assumes LFCLK is running at 32768Hz and will not produce accurate timeouts at other frequencies. LFOSC is an inherently inaccurate clock source and will present variations around the target 32768 Hz frequency. These inaccuracies have to be taken into consideration at the application level.
The reload value from which the Watchdog timer counts down may be changed during runtime using Watchdog_setReload(). This value should be specified in Watchdog clock ticks and should not exceed "2^32 - 1". This corresponds to a timeout period of 131071 seconds, calculated at the highest rate of 32768 kHz. If the reload value is set to zero, the Watchdog reset is immediately generated.
Watchdog_close() is not supported by this driver implementation. Once started, the Watchdog timer can only be stopped by a hardware reset.
No CC23X0 specific command has been implemented. Any call to Watchdog_control() will receive the return code Watchdog_STATUS_UNDEFINEDCMD.
The Watchdog module available on CC23X0 devices does not support reset masking or interrupt generation. Therefore, the two parameters Watchdog_Params::resetMode and Watchdog_Params::callbackFxn in the Watchdog_Params struct are not supported and will be ignored by the Watchdog driver.
Once started, the Watchdog will keep running in Active, Idle and Standby mode.
| Generic API Function | API Function | Description | |---------------------------— |-------------------------------— |------------------------------------------------— | | Watchdog_init() | WatchdogLPF3_init() | Initialize Watchdog driver | | Watchdog_open() | WatchdogLPF3_open() | Initialize Watchdog HW and set system dependencies | | Watchdog_clear() | WatchdogLPF3_clear() | Reload Watchdog counter | | Watchdog_setReload() | WatchdogLPF3_setReload() | Update Watchdog timer reload value in clock ticks | | Watchdog_convertMsToTicks() | WatchdogLPF3_convertMsToTicks() | Converts milliseconds to clock ticks |
In this basic watchdog example, the application is expected to start the Watchdog timer by calling Watchdog_open(). If needed, Watchdog_setReload() may be called to change the timeout period. If all monitored tasks are doing alright, Watchdog_clear() should be called regularly to reload the counter so as to restart the timeout period and to avoid the Watchdog resetting the device. If the Watchdog_clear() is missed and the Watchdog timer is allowed to timeout, the device will be reset.
The following code example shows how to correctly initialize the driver's parameters, start the Watchdog timer and modify at runtime the timeout period.
#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/Watchdog.h>
#include <ti/drivers/dpl/HwiP.h>
Go to the source code of this file.
Data Structures | |
struct | WatchdogLPF3_HWAttrs |
Watchdog hardware attributes for CC23X0. More... | |
struct | WatchdogLPF3_Object |
Watchdog Object for CC23X0. More... | |
Variables | |
const Watchdog_FxnTable | WatchdogLPF3_fxnTable |
Watchdog function table for CC23X0. More... | |
const Watchdog_FxnTable WatchdogLPF3_fxnTable |
Watchdog function table for CC23X0.