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/CC2640R2F: Manual watchdog handling with BLE

Part Number: CC2640R2F


Tool/software: TI-RTOS

Hi,

I wondere if you could help me with a recommandation:

I have set up a watchdog for keeping my system alive in unforeseen events.

But due to a variable sleep period, I need to turn off the watchdog at certain points. I do this like this in the watchdog callback:

if(watchdogisenabledflag){

system_reset();

}

else{

Watchdog_clear(mywatchdog);

}

Watchdog is handled in my custom task by the watchdogisenabled flag turned on and off. (hope you get my point).

My question is:

How can I implement this watchdog for the BLE code, is it enough to enable flag in the entry of the simple_peripheral task for(;;)-loop, like this:

static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1)
{
  // Initialize application
  SimpleBLEPeripheral_init();

  // Application main loop
  for (;;)
  {
watchdogisenabled = 1;
//all code that is happening
watchdogisenabled = 0;
  }
}

1. Is this necessary? Is there a risk for the BLE code hanging up on an assert or exception?

2. Is there a way to make the watchdog counter sleep when the system goes to sleep?

other comments are welcome as well,

BTW: basing my software on the simple_peripheral_oad_offchip code with SDK 1.40

Best regards,

Viggo

 

  • Hello Viggo,

    If it were me, I would use an Event based mechanism to control when the watchdog needs to be disabled (i.e., system reset since wdog can't be switched off once enabled) vs. a forever loop.

    Best wishes
  • Hi JXS,

    Thanks for replying.

    Can I ask if there a special reason why you would do it this way?

    If I understand it right, you mean reset the whole system when you want to go to sleep, and then go straight into sleep mode, for so enabling watchdog when you wake up the system again. Is that correct?

    What would be the benefit of this solution vs. the previous suggested?

    Best Regards,
    Viggo