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-Q1: Watchdog reset abnormally

Part Number: CC2340R5-Q1
Other Parts Discussed in Thread: CC2340R5

Tool/software:

Hi Team, 

My  customer is using CC2340-Q1 and and they have a scenario which need to sleep for a long time.

Due to there is no reset button in the design, they enable watchdog to prevent system hang.

But they meet  watchdog issue at SDK 8.10. The following is the steps:

1. enable watchdog

2. Clear WDT  &  Close  WDT

(3) Advertisement setting:

(4) But the log shows it watchdog reset every 5 seconds.

Please help to provide comments for  why the watchdog reset every 5 seconds.

Thanks.

  • Hi Team, 

    Please help to provide comments or suggestion for my customer to feed-back more info or run more test.

    Thanks.

  • Hello,

    I apologize for the late response. 

    There is a known quirk with the watchdog on the CC2340R5, you can read more about it here: Watchdog Timer Example Code — SimpleLinkTm CC23xx SDK BLE5-Stack User's Guide 3.03.01.00 documentation

    Please let me know if this helps, but to make sure I'm understanding the issue is that the watchdog is triggering after the handle is closed once the advertisements are disabled?

    Best,

    Nima Behmanesh

  • Hi Nima,

    Thanks for reply.

    As described , My customer used the official Basic BLE project and enable Watchdog function.
    Indeed, after the broadcast ended, it reset again after 5 seconds. 

    Besides, I have discuss w/ my customer,  he think setting the Watchdog reload value to 0xFFFFFFFF (~34 hours) may not  solve all the test scenarios.

    There is a test scenario that CC2340 enter stand-by over 34 hours, even longer. 

    Ref: Watchdog Timer Example Code — SimpleLink CC23xx SDK BLE5-Stack User's Guide 3.03.01.00 documentation

  • Hi Mike,

    Let me ask some of my colleagues what the best approach is to this issue.

    I'll also try to reproduce the issue on my side. If the handle is closed, the watchdog should not trigger.

    Best,

    Nima Behmanesh

  • Hey Mike,

    I received the code, please give me a couple days to try it out and get back to you

    Best,

    Nima Behmanesh

  • Hi Mike,

    Will be running the code today, and should have some update EOD.

    Best,

    Nima Behmanesh

  • Hi Mike,

    I've messaged you privately for the code.

    Best,
    Nima Behmanesh

  • Hello Mike, 

    I am looking into the code provided and have added some GPIO logging throughout the code. I will attach an capture from the program. 

    Can you instruct the customer to take a similar logic trace using GPIO_toggle? For more information on GPIO_toggle please see the GPIO.h documentation.

    Please see the RF Debug Section for more information on observing the RF output.  

    Within the log, notice that the Watchdog Timer Trigger never toggles. When the timer is complete, this callback will be entered. Since no toggle is seen, it makes me believe that the Watchdog is not initiating a reset. The watchdog reloads and opens within appMain. In a standard Basic_BLE project, appMain will only execute again after a reset, which seems to indicate the watchdog is resetting. 

    Please instruct the customer on how to take a similar logic trace and let me know if the customer is calling appMain somewhere else. I have yet to find an example of this in the project provided. 

    Thanks, 

    Isaac

  • Hi Issac, 

    Thanks for your comment. I have contact my customer to run the check.

    My customer want to know if TI have the example code which already integrate basic_ble and watchdog function.

    If Yes, it may save some time for my customer to integrate basic_ble and watchdog function.

    Thanks.

  • Hello Mike, 

    Nima previously provided our watchdog example code. Please reference the watchdog example code here

    Please provide a response with the check whenever available! 

    Thanks, 

    Isaac

  • 1.The product will be in IDLE state for more than one year before use.
    2.To reduce power consumption, "CLEAR WATCHDOG" will not be periodically woken up during idle periods.
    3.The method suggested by "NIMA" has been tried, but it is not suitable for application to actual products.
    4.Having the chip actually turn off the "watchdog" timing when idle. is our expectation.

    Thank you for your help

    BR.

  • Hello March, 

    I am still looking into the software provided. Was a logic trace taken similar to the one I sent previously? 

    I think I understand now, when the device is in idle mode, the watchdog will be disabled, but when the device is active, you want to have the watchdog. 

    Please expect a response by Friday 10/18. 

    Thanks, 
    Isaac

  • Hello  Isaac:

          "when the device is in idle mode, the watchdog will be disabled, but when the device is active, you want to have the watchdog."

    This is exactly the functionality we want。 

    Is there any chance of achieving it ?

    Thanks,

    March

  • Hello March, 

    This functionality is possible. The watchdog will need to be initialized and started when the device is coming out of idle/standby. Please see the function Power_getTransitionState(). This function will provide the current state, when the device moves into an active state, you can start the watchdog timer. Keep in mind that the watchdog timer will run through standby/idle mode, so it is important to use the Watchdog_close() function to stop the timer, then reset when the device goes back into active mode.

    For more information, please see the Power APIs, and the Watchdog APIs

    Thanks, 
    Isaac

  • Hello Isaac:

        Good Morning!
    As shown in the figure below,(Red frame) 
    In the "Advertising End" event, we executed, "Watchdog_close();"
    in theory it should have gone to sleep or idle until woken up.
    But why is the system still "watchdog-reset" after 5.5 seconds? And it keeps repeating.
    (P.s. Watchdog Period : 5.5 sec)

    When I changed the "Watchdog period" to "N" seconds, the system reset period was also changed to "N" seconds.

     

    Thanks,

    BR,

    March.

  • Hello March, 

    I will provide a more detailed response on Monday (10/21). 

    Thanks, 
    Isaac

  • Hello March, 

    Apologies for the delay in my response. I provided a logic trace earlier in the thread with the outputs I am seeing with your application. I am confused on where you are seeing the watchdog-reset last 5.5 seconds, and more specifically, where you are seeing the watchdog timer reset at all?

    Firstly, with the code that was provided, I do not see the watchdog resetting at all. I see advertisements starting every ~3.5-3.6 seconds, with the advertisements lasting for ~2 seconds, which is configured with the duration. Every time the advertisements end, the watchdog timer is closed. Additionally, the watchdog callback function should be entered every time the watchdog timer initiates a reset, which I am also not seeing. 

    Secondly, even if I did see evidence for the watchdog timer resetting, I don't understand where it is being determined that the reset is lasting 5.5 seconds. 

    Third, where are you configuring the device to go into standby? 

    Please provide a logic trace which includes the traces that I had in mine attached above. Additionally, if you are observing a 5.5-second-long reset, please provide some traces or information on this. 

    Thanks, 

    Isaac

  • Hello  Isaac,

    The Same code example.  (Mike Wu, who provided the code before)
    When I mark the following code.

    /*********************************************************************
     * @fn      appMain
     *
     * @brief   Application main function
     *
     * @return  none
     */
    void appMain(void)
    {
        // Call the BLEAppUtil module init function
        BLEAppUtil_init(&criticalErrorHandler, &App_StackInitDoneHandler,
                        &appMainParams, &appMainPeriCentParams);
    
    //    //==============================
    //    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;
    //
    //    uint32_t        reloadValue;
    //    watchdogHandle = Watchdog_open(CONFIG_WATCHDOG_0, &params);
    //    if (watchdogHandle == NULL)
    //    {
    //        /* Error opening Watchdog */
    //        while (1) {}
    //    }
    //    reloadValue = Watchdog_convertMsToTicks(watchdogHandle, TIMEOUT_MS);
    //
    //    if (reloadValue != 0)
    //    {
    //        Watchdog_setReload(watchdogHandle, reloadValue);
    //    }
    }
    

    After power on, it will only broadcast once and the UART message will only be displayed once,
    even if it has exceeded 5.5 seconds or even longer.

    When I unmark this code.
    It will broadcast according to the Watchdog period

    Please guide me how to modify this "basic_ble + Watchdog" sample code.

    so that it will no longer wake up the broadcast by itself.

    Thanks,

    BR,

    March.

  • March, 

    I see. Advertising is set to a duration of 2 seconds, because of the watchdog reset, advertising will begin again for another 2 seconds. Advertising lasts for 2 seconds, after this, the BLEAPPUTIL_ADV_END_AFTER_DISABLE event is raised. When this event occurs, the watchdog timer is cleared. When the watchdog timer is cleared, it begins counting to 5.5 seconds again. When the timer reaches 5.5 seconds, the device resets and advertising begin again. 

    Section 8.6 in the datasheet states "Upon counter expiry, the watchdog timer resets...", and "...cannot be stopped once enabled.". Basically, once the watchdog is enabled, you cannot disable it. To reset the watchdog timer, the timer needs to be reloaded every time it nears the timeout time. Clear will clear the timer value, but when this occurs, the timer is reloaded and restarts. To avoid this, try reloading the timer periodically before the timeout occurs. 

    Another option is using the Watchdog_RESET_OFF resetMode parameter. Instead of initiating a reset, the watchdog timer will generate an interrupt instead of a reset. Within the interrupt you can decide if the device should be reset or keep running. Also, if you want to continuously advertise, you will need to add additional logic. Setting the advertising duration to 200, will advertise for 2 seconds, then stop advertising until advertising is re-enabled. 

    Let me know if this helps, and apologies for the delay. 

    Thanks, 

    Isaac

  • Hello , Isaac

        I've tested your suggestion. (Watchdog_RESET_OFF resetMode)

    However, the result is still the same reset.

    Thanks,

    March.

  • Hello March, 

    As previously mentioned, this is another option. For this option you will need to reset the device within the interrupt callback. Using Watchdog_RESET_OFF changes the watchdog from resetting when the timer expires, to generating an interrupt when the timer expires. The reset logic will need to be added to the software. 

    My first recommendation was using the Watchdog_setReload() function to reload the watchdog when the timer is nearing the end. Since the watchdog timer cannot be disabled once enabled, the only way to ensure the watchdog does not reset the device is by reloading the timer. Watchdog clear will not stop the watchdog from resetting, only reloading the timer will allow for this. 

    Please test both of these out. 

    Thanks, 
    Isaac