Tool/software: TI-RTOS
I'm trying to add the watchdog functionality to a heavily modified sensortag example.
SW versions: BLE SDK 2_02_02_25, TI RTOS 2_21_01_08, BLE STACK 2-2-2 and CCS 7.4
In my board.c I have:
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(Watchdog_config, ".const:Watchdog_config")
#pragma DATA_SECTION(watchdogCC26XXHWAttrs, ".const:watchdogCC26XXHWAttrs")
#endif
WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650STK_WATCHDOGCOUNT];
const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650STK_WATCHDOGCOUNT] = {
{
.baseAddr = WDT_BASE,
.intNum = INT_NMI_FAULT, /* INT_WDT_IRQ or INT_NMI_FAULT ?? */
.reloadValue = 3000 /* Reload value in milliseconds */
},
};
const Watchdog_Config Watchdog_config[] = {
{
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
.object = &watchdogCC26XXObjects, /* CC2650STK_WATCHDOG0 */
.hwAttrs = &watchdogCC26XXHWAttrs /* CC2650STK_WATCHDOG0 */
},
{NULL, NULL, NULL},
};
const uint_least8_t Watchdog_count = CC2650STK_WATCHDOGCOUNT;
In my application:
#define WDT_MS 3000
void watchdog_callback(UArg handle){
Watchdog_clear((Watchdog_Handle)handle);
}
void watchdogtimer_init(){
Watchdog_Params wdParams;
uint32_t tickValue;
// open watchdog
Watchdog_init();
Watchdog_Params_init(&wdParams);
wdParams.resetMode = Watchdog_RESET_ON;
wdParams.debugStallMode = Watchdog_DEBUG_STALL_ON;
wdParams.callbackFxn = watchdog_callback;
wdtHandle = Watchdog_open(Board_WATCHDOG, &wdParams); // CC2650STK_WATCHDOG0
tickValue = Watchdog_convertMsToTicks(wdtHandle, WDT_MS);
Watchdog_setReload(wdtHandle, tickValue);
}
in my main task init I successfully call:
watchdogtimer_init();
After 3 seconds (WDT_MS 3000) there'es a HW exception and the os is spinning in:
/* spin here if no exception handler is plugged */
while (Hwi_excHandlerFunc == NULL) {
;
}
I have experimented with stuff that I've found in e2e but none have worked for me:
- Applied the fixes that are mentioned here: https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/532111
- Watchdog_RESET_OFF instead of Watchdog_RESET_ON
- INT_WDT_IRQ instead of INT_NMI_FAULT -> then the device is rebooting after 3 seconds subsequently instead of spinning in the 'unhandled' HW exception -> it then looks like the wathdog is not triggered in time
- Modifying the WatchdogCC26XX.c driver to use INT instead of NMI like mentioned here: https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/532111