Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK, SIMPLELINK-CC2640R2-SDK
Tool/software: Code Composer Studio
Version information CCS version: 7.1.0 TI-RTOS 2.20 TI BLE-Stack 3.00.00.22
I am trying to use the internal watchdog to reset my device, but I cannot get this functionality to use.
I have tried both the driver interface and the driver lib interface and even by setting necessary regisers in the controller.
I have read some threads in this forum and search on other sites but dont find the answer. In some places it states that the watchdog is exprimental but I guess that this means the driver layer.
When running with the debugger the callback is called every 5 seconds, but now reset because, as far as I understand, the reset functionality for soft reset is inhibited.
Without the debugger I dont see any reset. have a LED flash at power up but does only see it once at the first power up. The functionality of the device works as it should (except that it should reset every 10th second)
I have also tried to call SysCtrlSystemReset() from the callback function but I this does not reset the device. Outside the callback it works
I guess that it is some small thing that I have forgot but what?
The code below. (main is calling HALInit() then HAL_WDT_Enable() and I never call the HAL_WDT_Kick() )
/* Handle for the watchdog */
static Watchdog_Handle HAL_WDT_Handle;
void HAL_Init()
{
...
/* Call board init functions */
Watchdog_init();
...
}
void HAL_WDT_Callback(uintptr_t unused)
{
/* Clear watchdog interrupt flag */
Watchdog_clear(HAL_WDT_Handle);
}
void HAL_WDT_Enable(void)
{
Watchdog_Params params;
uint32_t ticks;
/* Create and enable a Watchdog with resets disabled */
Watchdog_Params_init(¶ms);
params.callbackFxn = (Watchdog_Callback)HAL_WDT_Callback;
params.resetMode = Watchdog_RESET_ON;
// params.debugStallMode = Watchdog_DEBUG_STALL_ON;
HAL_WDT_Handle = Watchdog_open(Board_WATCHDOG0, ¶ms);
if (HAL_WDT_Handle == NULL)
{
/* Error opening Watchdog */
while (1);
}
ticks = Watchdog_convertMsToTicks(HAL_WDT_Handle, 5000);
(void)Watchdog_setReload(HAL_WDT_Handle, ticks);
}
void HAL_WDT_Kick(void)
{
Watchdog_clear(HAL_WDT_Handle);
}
Regards Örjan