How to add watchdog support in cubecell?

Require watchdog support in CubeCell but couldn’t find any example or way to add watchdog in application, so, can someone explain how to add it? or watchdog example would be better to understand
Thank you in advance for your support

The ASR650X chip has an internal watchdog. But this watchdog function is very bad… the maximum dog feeding time only 2S

It means if the system is in the deep sleep status, the system need to wake up every 2 seconds to feed the dog, that’s very unfriendly for low power features.

So, you may need consider add an external watchdog chip or module.

1 Like

How would I enable this internal watchdog function of the ASR650X Chip?

With my current use that is not a concern, but space is! So the internal watchdog even as it is unfriendly would still work for me, How would I enable it?

Can you not switch the watchdog off after it has sucesfully completed X task?

you could use the TPL5010.
I need a watchdog too in my circuit and the TPL5010 “only” needs to get feed every 7200s (2h).
regarding to the datasheet the current consumption is about 35nA and therefore suitable for low power circuits. Anyway 2h is much better than 2s, but you guys know maybe an other external watchdog who has to be feeded even less? @Supporter

hi,

you can refer this code:

Hello WASN,
maybe i’m wrong but using the below code seems to keep the system asleep without interruption and when it wakes up it feeds the WDT properly does it’s think and go back to sleep…

Note: innerWdtEnable(true); then the module never goes to sleep, and keep waking up as you said to feed the WDT so the trick is to set to false and find a way to feed the WDT when awake.

void setup()
{
  /* Enable the WDT, autofeed is set to false we will feed it our self */
  innerWdtEnable(false);
}

void loop(){
  switch (deviceState)
  {
  case DEVICE_STATE_INIT:
  {
#if (LORAWAN_DEVEUI_AUTO)
    LoRaWAN.generateDeveuiByChipID();
#endif
#if (AT_SUPPORT)
    getDevParam();
#endif
    printDevParam();
    LoRaWAN.init(loraWanClass, loraWanRegion);
    deviceState = DEVICE_STATE_JOIN;
    break;
  }
  case DEVICE_STATE_JOIN:
  {
    LoRaWAN.join();
    break;
  }
  case DEVICE_STATE_SEND:
  {
    CySysWdtEnable(); //enable the WDT
    prepareTxFrame(appPort);
    LoRaWAN.send();
    deviceState = DEVICE_STATE_CYCLE;
    break;
  }
  case DEVICE_STATE_CYCLE:
  {
    // Schedule next packet transmission
    txDutyCycleTime = appTxDutyCycle + randr(0, APP_TX_DUTYCYCLE_RND);
    LoRaWAN.cycle(txDutyCycleTime);
    CySysWdtDisable(); //disable the WDT before going to sleep
    deviceState = DEVICE_STATE_SLEEP;
    break;
  }
  case DEVICE_STATE_SLEEP:
  {
    LoRaWAN.sleep();
    break;
  }
  default:
  {
    deviceState = DEVICE_STATE_INIT;
    break;
  }
  }
 Serial.print("."); //it will stop printing when it's in deep sleep.
 feedInnerWdt(); //as long as we are awake continue to feed the WDT ....
}

what do you think? or am i wrong here…?

Hi jayjay,

I think your thinking is right - no interrupts while sleeping.
It might be a good solution in combination with the real watchdog.

The current watchdog implementation from Heltec seems to use the WCO_WDTx timer(s), not the real watchdog, when I’m correct.
A WCO_WDTx timer will generate an IRQ when not fed, but not force a system reset after missed feeding times, like the real dog. A good watchdog should bite when needed - not just bark, right?

In fact these WCO_WDT timers would make a great deep sleep timer: 0 - 2^17 sec (36.4h) sleeping time, or way longer even, when putting all 3 timers in cascade.

HI peterm,
thanks for the updates, please take a look my proposed solution below and tell me what do you think?

Hi jayjay,

Please see my comments in the other thread lowPowerHandler(); & TimerLowPowerHandler()

Are my concerns re: “too soft” WDT implementation justified, or did I miss something?