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

Confusion between nrf_ and nrfx_

Hello,

I'm doing some clean up in my code and i wanted to use only nrfx library as it advised to do. Regarding the watchdog i have set in my app_config.g file (used by my sdk_config.h) the following flags : 

#define NRFX_WDT_ENABLED                      1
#define NRFX_WDT_CONFIG_BEHAVIOUR             0 // Watchdog will be paused in SLEEP and HALT 
#define NRFX_WDT_CONFIG_RELOAD_VALUE          5000

But if i don't add the following line : 

#define WDT_ENABLED                           1

It won't compile, is ti normal ?

Regards,

Aurélien 

Parents
  • HI Aurélien, 

    You need to remove the legacy config section from the sdk_config.h file if you're only using nrfx, i.e. remove the below lines

    // <e> WDT_ENABLED - nrf_drv_wdt - WDT peripheral driver - legacy layer
    //==========================================================
    #ifndef WDT_ENABLED
    #define WDT_ENABLED 0
    #endif
    // <o> 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 WDT_CONFIG_BEHAVIOUR
    #define WDT_CONFIG_BEHAVIOUR 1
    #endif
    
    // <o> WDT_CONFIG_RELOAD_VALUE - Reload value  <15-4294967295> 
    
    
    #ifndef WDT_CONFIG_RELOAD_VALUE
    #define WDT_CONFIG_RELOAD_VALUE 2000
    #endif
    
    // <o> WDT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef WDT_CONFIG_IRQ_PRIORITY
    #define WDT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // </e>
    

    Otherwise, the apply_old_config.h file will undefine NRFX_WDT_ENABLED and set it to the same as WDT_ENABLED, which is zero, which in turn results in the nrfx_wdt.c not being compiled in, see below

    // from apply_old_config.h
    
    #if defined(WDT_ENABLED)
    
    #undef NRFX_WDT_ENABLED
    #define NRFX_WDT_ENABLED  WDT_ENABLED

    Best regards

    Bjørn

  • Hi ,

    Can you please tell me the difference between NRFX_WDT_ENABLED and WDT_ENABLED?

    If I have setting for NRFX_WDT_CONFIG_RELOAD_VALUE  to 20000 and WDT_CONFIG_RELOAD_VALUE to 60000 so which value will be taken for wdt reload value?

    I have enabled both in my application.

Reply Children
No Data
Related