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 

  • 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,

    Thank you very much for the reply. My bad, indeed i didn't see this. Actually, at the begening i didn't want to modify the sdk_config file because i take it from nordic example, and i make the modifications in a differente file : app_config

    I was doing this in order to ease the porting of new SDK. But i guess in the future SDK example, only NRFX driver will be used.

    Thank you again for your time, i will follow what you said for every peripherals.

    Best regards,

    Aurélien

    Edit : Finally, it is more complicated than expected. Indeed, i'm using the last release of SDK (16.0.0) and FreeRTOS is using the old interface for clock configuration so i can't remove old driver version from my project. More over with some peripherals such as SAADC i'm facing diffrente behavior with the new interface. Maybe i'm doing something wrong, si i think i will postponed this task and wait for the next SDK release. i hope all example projects from the SDK will use NRFX interface because for now it is not the case.

  • 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.

Related