Unable to change WDT reload value in FreeRTOS example.

Hi,

We had WDT added to FreeRTOS application with 24 hours timeout. This was working fine. But we tried to change it to 2 hours timeout and it is not working. It is still taking a 24 hours to reset the system with WDT. What could be the issue? I can see that nrf_wdt_started() returns true on reset in debugging. 

Tried the method mentioned in this thread. But still not working. Tried to change the reload value to 20 seconds and still not working. Any known workaround for this? How can I change it to a different reload value and release for new OTA firmware updates?


Thanks,
Vishnu Pradeep

Parents
  •   Can you go through the WDT settings in the project we've shared earlier?

  • Hi Vishnu, 

    I am sorry but I cannot find the project that you shared with me. Can you please share the project or the link again? WDT is very mature solution on nRF52840 and has been tested with many FreeRTOS projects. So it has to be some configuration issue.

  • Hmm, let me see if I understand this correctly.

    You have an advertising issue which was the main reason to look into reset. And you looked in WDT as a workaround to reset the chip for that. And you see issues with the WDT with time and then you are using soft reset as a workaround to the issue to the WDT.

    I do not understand why your WDT issue is not working correctly. You need to debug that first by disabling everything else apart from the WDT feature. I have not seen WDT not functioning this way before.

    Vishnu Pradeep said:
    But for some reason this is not resetting the system. But if I explicitly do sd_power_system_off and sd_nvic_SystemReset by sending a command it is working as expeced.

    This is again workaround to a workaround and I do not know the context in which you are calling this. Why would you do system_off and system_reset at the same time? These two are different things. If you just want a reset, you should just call a sd_nvic_systemreset. And that should work.

  • Yes correct. We added WDT as a fail safe mechanism to restart the system if there is no BLE events for 24 hours. Later we tried to reduce the preload value to 2 hours and tried OTA and realised WDT is not resetting system after 2 hours, but only after 24 hours. Then started digging.

    So the problem is WDT is not getting disabled with sd_nvic_systemreset. That is why I tried with sd_power_system_off and then reset. This time it was able to change the preload value. Only a WDT reset or a POR can only disable the WDT and thereby reconfigure the WDT, if my understanding and experimentation is correct.

    Even we didn't like the workaround as we don't know what other things can break because of this. Can you try it on your side and check if it is working without this workaround. 


  • Vishnu Pradeep said:
    So the problem is WDT is not getting disabled with sd_nvic_systemreset. That is why I tried with sd_power_system_off and then reset. This time it was able to change the preload value. Only a WDT reset or a POR can only disable the WDT and thereby reconfigure the WDT, if my understanding and experimentation is correct.

    Your observation and understanding is correct. If you can look into the POWER-Reset-Retained Registers section. You can see in the table that for Soft-Reset (nvic_systemReset) the watchdog is not reset and will retain its registers and hence its old configuration. And you can also see that with System OFF mode reset, the WDT registers are reset. So it is best to use systemoff if you want to automate this.

  • Ok. But any idea why it is not resetting to the application and going to system off mode if I do in the beginning of code and working if I send a command to do systemoff.

  • It should make the chip go to systemoff at any stage. Not sure why it is working only when you send a command.

    How early are you calling system off in the application? Are you doing this after you setup the wakeup source and make sure that the wakeup source is not active?

Reply Children
Related