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

WDT reload value after reprogramming

Hi,

I'm trying to configure the watchdog timer for my application but I am running into some "weird" things.

Is it correct that the reload value cannot be set once the wdt is started? This seems to be my experience and this also also what I have read on the devzone.

Is it normal that a "nrfjprog --recover" is not enough to reset the watch dog and change the value? Meaning if I set the wdt to a certain value after which I perform the recover command and then reprogram the firmware in SES the reload value remains unchanged. Reprogramming the firmware in SES is not able to change the value of the reload value. 

The only way to change the reload value seems to be to reflash the device with different firmware with different wdt settings and to put the device in power off mode (sd_power_system_off();). I assume power cycling would work as well but I imagine this is difficult in many battery powered applications.

So long story short: It seems to be impossible to change the reload value of the wdt once it is started and it also seems to be impossible to disable the watchdog timer once it is started. This makes it kind of tricky to get it to work with the dfu bootloader for example (assuming people do not want to change the bootloader I guess). Is there a recommended workaround for this issue?

Also somewhat related, making changes to the sdk_config.h file does not seem to do anything sometimes.

I am using the NRF52840 with the 15.2 sdk.

Regards,

Michiel

Parents
  • Hi,

    Sorry, I might have been a bit to soon to complain about the dfu bootloader, I looked at the code (I'm using the one in examples/dfu/secure_bootloader) and it does account for a wdt and it seems to be working pretty well out of the box. So that's nice since I read a couple of issues on the message board. These might have been on older sdk versions.

    I am still interested in the other questions though.

    Regards,

    Michiel

  • Hi Michiel,

    Thanks for updating the ticket. Yes, once you have started the WD there isn't much you can in do in SW to stop or reconfigure it except for letting time out. WD is kept running through several of the available reset sources including soft reset, see Reset behavior.

    Also somewhat related, making changes to the sdk_config.h file does not seem to do anything sometimes.

     The header may include some configuration settings that are not referenced in the code. Please make sure you have included the necessary source files for the feature you are trying to configure.

    Regards,

    Vidar

  • Hi,

    Thanks for your answer and the additional information on the reset behavior.

    On the configuration settings:

    All the files are included in the project, I double checked if the right files are added and that I am editing the correct config file.

    In this case I edited the sdk_config file like this to enable the wdt:

    // <e> NRFX_WDT_ENABLED - nrfx_wdt - WDT peripheral driver
    //==========================================================
    #ifndef NRFX_WDT_ENABLED
    #define NRFX_WDT_ENABLED 1
    #endif

    when I do this the nrfx_wdt.c file stays "grayed out" because the conditional is not satisfied and the build fails during the link step because the functions in this file are not found. However when I add

    #define NRFX_WDT_ENABLED 1

    as a workaround at the top of the nrfx_wdt.c file the build succeeds and everything works fine. I tried making a clean build, restarting SES and rebooting my pc all without success. Any thoughts or suggestions would be greatly appreciated. 

    Thanks and best regards,

    Michiel

  • Hi,

    Is the legacy configuration 'WDT_ENABLED' included in your header? The integration layer may override NRFX_* settings with the legacy settings if both are defined. As an example, the NRFX_WDT_ENABLED would become disabled if WDT_ENABLED was set to 0.

  • Hi,

    Thanks, I did in fact not enable the wdt_enabled, only the legacy setting.

    Thanks!

    Michiel

Reply Children
No Data
Related