This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC1310: watchdog for multi-threaded application on cc1310

Part Number: CC1310
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(&params);
watchdogHandle = Watchdog_open(0, &params);
Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));

/* Avoid standby to keep the watchdog running */
Power_setConstraint(PowerCC26XX_SB_DISALLOW);

}

 

 

 

  • Hi,

    First of all, you are using quite an old SDK version; it could be a good idea to update it.

    Secondly, are you writing all your code in the same file? I mean normally a part of the code such as watchdog_objects, watchdog_hwAttributes, Watchdog_config is supposed to be in what we call “board files” (Board.h, CC1310_LAUNCHXL.h and CC1310_LAUNCHXL.c). If your project is just made for some small tests, it should not be a problem, however if you are planning to develop a bigger project you should pay attention to this point.

    Regarding the error you are experiencing: the linker cannot find one of the symbols he needs. The Watchdog driver relies on the variable Watchdog_count but this variable has not been declared. If you simply declare somewhere the missing variable, it should be fine (you can add this declaration: const uint_least8_t Watchdog_count = 1). Please note that normally this declaration is made in CC1310_LAUNCHXL.c

    Last remark, you should use the SyntaxHighlighter when posting large pieces of code on E2E (the </> icon). Thanks!

    I hope this will help you,