This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FreeRtos vTaskDelayUntil affect WDT Timeout

Hi 

I am using the NRF52832 ,my code is based on the ble_app_hrs_freertos example sdk 15.0.0 

I have one main task which usually run 64 time every second using the vTaskDelayUntil(&xLastWakeTime, 16)  .

and when trying test the WDT(which is configured to give timeout event after 4000ms) without feeding it a WDT event happens after more than 12 seconds!!!!.

I notice that both the WDT and the freeRtos is using the RTC timer and when i watched the NVIC parameters (the RTC1 and WDT) enable went on/off all the time .

 

Do you have any idea why i get this kind of behavior ??

Thanks a lot

Ibrahim 

Parents
  • Hi Ibrahim,

    and when trying test the WDT(which is configured to give timeout event after 4000ms) without feeding it a WDT event happens after more than 12 seconds!!!!.

    There is nothing in the system that could postpone the WDT timeout event from 4 seconds to 12 seconds. Seems like some of the task in your application is feeding the watchdog. 

    1. Can you please explain the watchdog feeding task mechanism and the task run frequency?
    2. Can you toggle a gpio everytime it feeds the WDT so that we know that WDT is being fed.

    In short, there is no possible way I can see that the WDT is not being fed and still does not timeout immediately after 4000ms. If it does, there is a serious bug in the hardware which is very unlikely.

  • Thank you Susheel for the quick replay 

    i actually have one place that feeds the WDT and it's in the Init function 

    I set a breakpoint on the function nrf_wdt_reload_request_set and counted the time from calling this function until WD reset event and i counted 12 seconds (without feeding the dog in the middle) 

    Without any feeding to the WDT it actually happens after 4 seconds. but that doesn't explain why after 12sec from 1 feeding we get a WDT event

    This is how we feed the WDT :

    //Reload the WDT_REGISTER value.
    nrfx_wdt_channel_feed(NRF_WDT_RR0);

    Thanks a lot 

    ibrahim 

  • This does not sound correct, Can you please give me a minimalistic project to replicate the issue. I will try to debug this both in software and hardware level to see if WDT is really configured for 4 second timeout but the reset you see is 12 seconds after you last fed the WDT. 

  • Thank you Susheel

    Before i send you the project 

    Is it possible that the softdevice feed the dog? 

    Thanks a lot 

    Ibrahim

  • Softdevice does not use WDT

Reply Children
  • Thank you 

    I need the support as soon as possible so i tried to contact Thomas but he is in vacation 

    How can i send you the code ?

    Thanks a lot 

    Ibrahim

  • Hi Ibrahim,

    I have some issues with my laptop and gave it to IT to fix it, unfortunately I would have to look into this before Monday when i get a new laptop. Sorry about the inconvenience.

  • Hi

    Any update on the issue ?

    Best regards

  • Hello Ibrahim,

    Sorry for the delay. Susheel is out of office, and I will handle your ticket. 

    I have two questions:

    - You say that the watch dog times out after 4 seconds if you feed the watchdog in your init function. Are you sure that your application doesn't reset before the 12 seconds pass? If you try to set a breakpoint on where you feed the watchdog right after you start the application, you should be able to tell if it is being called again due to a reset. 

    - There are some options when you initialize the watchdog. You probably call nrf_drv_wdt_init(&config, wdt_event_handler) somewhere in your project.

    Can you please check what your config.behaviour is?

    From sdk_config.h:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    // <o> NRFX_WDT_CONFIG_BEHAVIOUR - WDT behavior in CPU SLEEP or HALT mode
    // <1=> Run in SLEEP, Pause in HALT
    // <8=> Pause in SLEEP, Run in HALT
    // <9=> Run in SLEEP and HALT
    // <0=> Pause in SLEEP and HALT
    #ifndef NRFX_WDT_CONFIG_BEHAVIOUR
    #define NRFX_WDT_CONFIG_BEHAVIOUR 1
    #endif
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    If it is not 9, can you please try to set it to 9 before nrd_drv_wdt_init(&config, wdt_event_handler)? Does it still behave the same?

    Best regards,

    Edvin