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.

CC2340R5: CC2340R5 : Watchdog resets continuously after its timeout.

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Hello,

I'm using CC2340R5 SDK 7.20 example code basic_ble. 

I want to implement watchdog in my current code for my project. 

Our application is: BLE wakes up from a GPIO interrupt only and broadcast data and then goes to standby state until the next interrupt occurs.

So, for this application I want to implement watchdog.

I have configured watchdog taking reference from example code of watchdog.

Below is my code : 

Here, I'm configuring interrupt as well as watchdog in this function. 

void mainThread(void)
{
    /* Configure GPIO pin */
    GPIO_setConfig(CONFIG_GPIO_EXT_WAKEUP, GPIO_CFG_IN_PD | GPIO_CFG_IN_INT_FALLING);  //Since, low & high value interrupts are not available for Low Power F3 devices

//    GPIO_setConfig(CONFIG_GPIO_EXT_WAKEUP, GPIO_CFG_IN_INT_FALLING);

    /* Install GPIO Interrupt callback */
    GPIO_setCallback(CONFIG_GPIO_EXT_WAKEUP, gpioButtonFxn0);

    /* Enable interrupts */
    GPIO_enableInt(CONFIG_GPIO_EXT_WAKEUP);

    //Rushi
    Watchdog_Params params;
//    Watchdog_Handle watchdogHandle;

    /* Call driver init functions */
    GPIO_init();

    Watchdog_init();

    /* Open a Watchdog driver instance */
    Watchdog_Params_init(&params);
    params.callbackFxn    = (Watchdog_Callback)watchdogCallback;
    params.debugStallMode = Watchdog_DEBUG_STALL_ON;
    params.resetMode      = Watchdog_RESET_ON;

    watchdogHandle = Watchdog_open(CONFIG_WATCHDOG_0, &params);
    if (watchdogHandle == NULL)
    {
        /* Error opening Watchdog */
        while (1) {}
    }

This is the callback function of interrupt : 

/*Interrupt Callback*/
void gpioButtonFxn0(uint8_t index)
{
    BLEAppUtil_invokeFunctionNoData(enableAdvertising);

}

And in this function I'm broadcasting and clearing watchdog. 

/*This function enables advertising and does broadcast the TPMS data*/
void enableAdvertising()
{
    bStatus_t status;

    delay(7000);

    BLEAppUtil_advStart(broadcasterAdvHandle_1, &broadcasterStartAdvSet1);
    /*Don't free anything since we're going to use the same buffer to re-load*/
    status = GapAdv_prepareLoadByBuffer(advData1, FALSE);

    if (status == SUCCESS)   /*   Only update the data when return is successful*/
    {
        SensorMeasure();

        uint8_t ADV_DATA2_LEN = sizeof(advData1); /* Reload buffer to handle*/

        GapAdv_loadByBuffer(ADV_DATA2_LEN, advData1);
    }

//    usleep(SLEEP_US);
    Watchdog_clear(watchdogHandle);

}

 declared watchdogHandle globally. 

The main issue here is the watchdog gives reset after its timeout even though I've cleared it.

Also, have called the mainthread in main function. And while debugging code does not enter into the callback mentioned above. It gets stuck somewhere in function   vTaskStartScheduler();

The watchdog resets continuously after its timeout.

  • Hi,

    Thank you for reaching out. I see that you are using the 7.20 SDK, if possible, then I would suggest migrating to the latest 7.40 SDK which includes new features, bug fixes, and general improvements.

    We will take a look at your questions and get back to you as soon as possible.

    Best Regards,

    Jan

  • Hello Rushikesh,

    May I ask how do you have configured the Watchdog timer in SysConfig (if you have)?

    I can also share with you the Watchdog driver documentation (you can find it inside <SDK>\docs\drivers\doxygen\html). Look for _watchdog_8h.html where you can see an example of how to use it as well as the description of each api function.

    BR,

    David.