Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hi,
I am trying to make software watchdog to check if all tasks are going on or halted for long, I got a hint from https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/p/529212/2081970#2081970 this reply.
I am using sdk cc1310 - 1.50. Since then watchdog library is changed somewhat eg. .intNum = INT_WDT_IRQ, field is removed from WatchdogCC26XX_HWAttrs . On compiling i am getting a linking error.
Below is the code i am using for watchdog thread. What's gone wrong?
#include <xdc/std.h>
#include <xdc/runtime/System.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Queue.h>
#include "switch_box.h"
#include <driverlib/sys_ctrl.h>
#include <ti/drivers/Watchdog/WatchdogCC26XX.h>
#include <ti/drivers/power/powerCC26xx.h>
#define WATCHDOG_COUNTx 1
#define WATCHDOG_TIMEOUT_MS 5000
Task_Params wdtTaskParams;
Event_Handle watchdogEvent;
Task_Struct wdtTaskStruct;
Char wdtTaskStack[128];
uint32_t events;
Watchdog_Handle watchdogHandle;
WatchdogCC26XX_Object watchdog_objects[WATCHDOG_COUNTx];
const WatchdogCC26XX_HWAttrs watchdog_hwAttributes[WATCHDOG_COUNTx] = {
{
.baseAddr = WDT_BASE,
// .intNum = INT_WDT_IRQ,
.reloadValue = 10000
}
};
const Watchdog_Config Watchdog_config[WATCHDOG_COUNTx] = {
{
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
.object = &watchdog_objects,
.hwAttrs = &watchdog_hwAttributes
}
};
void watchdog_kickWatchdog()
{
Watchdog_setReload(watchdogHandle, WATCHDOG_TIMEOUT_MS);
}
void watchdogTaskFunction() {
while(1) {
// ..
// We use Event's AND mask here. Event_pend() will either return all events or 0 on a timeout.
events = Event_pend(watchdogEvent, TaskAlive1Event | TaskAlive1Event, Event_Id_NONE, WATCHDOG_TIMEOUT_MS);
if (events == 0) {
// Timeout, put the system into a safe state
SysCtrlSystemReset();
} else {
// Kick hardware watchdog
// do software reset
watchdog_kickWatchdog();
}
Task_sleep(1000);
// ..
}
}
void watchdogTask_init(void){
/* Construct WDT Task thread */
Task_Params_init(&wdtTaskParams);
wdtTaskParams.stackSize = sizeof(wdtTaskStack);
wdtTaskParams.stack = wdtTaskStack;
wdtTaskParams.priority = Task_numPriorities - 1; // highest priority
Task_construct(&wdtTaskStruct, (Task_FuncPtr)watchdogTaskFunction, &wdtTaskParams, NULL);
Watchdog_init();
Watchdog_Params params;
Watchdog_Params_init(¶ms);
watchdogHandle = Watchdog_open(0, ¶ms);
Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));
/* Avoid standby to keep the watchdog running */
Power_setConstraint(PowerCC26XX_SB_DISALLOW);
}