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: cc2640r2f watchdog about ble advertising

Part Number: CC2640R2F

Tool/software: TI-RTOS

Hello,

My development environment is as follows:
SDK version: simplelink_cc2640r2_sdk_1_35_00_33
IC: CC2640R2FRGZ

Enable watchdog in SimpleBLEPeripheral_init(),
Kick watchdog in SimpleBLEPeripheral_taskFxn(),
The code is as follows.

static void SimpleBLEPeripheral_init(void)
{
  // ******************************************************************
  // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
  // ******************************************************************
  // Register the current thread as an ICall dispatcher application
  // so that the application can send and receive messages.
  ICall_registerApp(&selfEntity, &syncEvent);

  ...
  
  Board_initWatchdog();
  
  Watchdog_Params_init(&params);
  params.resetMode = Watchdog_RESET_ON;
//  params.callbackFxn = UserCallbackFxn;
  hWdt = Watchdog_open(Board_WATCHDOG0, &params);
  if (hWdt == NULL) {
    // Error opening watchdog
    for (;;){}
  }
  
  ...
}

/*********************************************************************
 * @fn      SimpleBLEPeripheral_taskFxn
 *
 * @brief   Application task entry point for the Simple BLE Peripheral.
 *
 * @param   a0, a1 - not used.
 *
 * @return  None.
 */
static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1)
{
  // Initialize application
  SimpleBLEPeripheral_init();
  
  // Application main loop
  for (;;)
  {
    uint32_t events;

    // Waits for an event to be posted associated with the calling thread.
    // Note that an event associated with a thread is posted when a
    // message is queued to the message receive queue of the thread
    events = Event_pend(syncEvent, Event_Id_NONE, SBP_ALL_EVENTS,
                        ICALL_TIMEOUT_FOREVER);

    Watchdog_clear(hWdt);

    ...
  }
}

When the system only do the Bluetooth broadcast,
and other timer related things are in standby,
In this time the system will enter sleep mode and the watchdog should also go to sleep.
Q1: When the system is going to perform Bluetooth broadcast, will it leave sleep mode briefly and let the watchdog wake up briefly?
Q2: If so, how do you feed the dog during this time to avoid a system reboot for a long time?

  • Hi David,

    1) When the device is waking up to do the actual broadcast, the watchdog also wakes up. Or more precisely the whole chip wakes up, allowing it to process the watchdog as well.
    2) When the chip is in standby, the watchdog is paused so it will never reboot the system.
  • 1) When the device is waking up to do the actual broadcast, the watchdog also wakes up. Or more precisely the whole chip wakes up, allowing it to process the watchdog as well.
    >> OK
    2) When the chip is in standby, the watchdog is paused so it will never reboot the system.
    >> I mean that when the device is waking up to do broadcasting rather than when the chip is in standby.
    When the device is waking up to do broadcasting, how can I feed the dog during this time to avoid a system reboot for a long time?
  • Hi David,

    You call the Watchdog_Clear() every time there is a event. As Marie H mentions "whole chip wakes up, allowing it to process the watchdog as well"

    Some important reminders below regarding Watchdog.

    - The Watchdog Countdown stops if the device is in Standby Mode and advertisement is disabled.
    - The Watchdog Countdown is delayed if the device is in Standby Mode and advertisement is enabled. From my testing a 1 second Watchdog Reload value will countdown to 0 in 29 seconds using Simple Peripheral for testing.

    -kel
  • Hi Markel,

    Thanks for your reply.

    - The Watchdog Countdown is delayed if the device is in Standby Mode and advertisement is enabled. From my testing a 1 second Watchdog Reload value will countdown to 0 in 29 seconds using Simple Peripheral for testing.

    In this case, is there any method to prevent the device to reset?
  • Hi All,

    David is asking for the value reset of watchdog while in advertising event, does the value will be reset due to every advertising event happen, if not, then he is worry about the watchdog cause their system reboot in uncertain status.

    _

  • Hi David,

    I did a CC2640R2F project that uses Watchdog. Upon initialization it goes to Shutdown Mode. It wakes up upon button press and advertises in 1 minute. If there is no connection it goes to Shutdown Mode. I have set the Watchdog Reload value to 15 seconds. So if it is advertising for 1 minute it does not reset. If there is a event such as button press, bluetooth connection and others Watchdog_Clear() is called.

    In the implementation above I am able to handle the Watchdog. In your case you need to know how long your device advertises and handle the watchdog, maybe implement a periodic timer to call Watchdog_Clear() in the condition there is no bluetooth connection.

    -kel
  • Hi Markel,
    I got it .
    Thank you for complete explanation!!