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

Upgrade to the nrfx API (SDK V15)

Hello,

I am using the NRF52-DK softdevice 6.0.0 and NRF SDK 15.0.
The app is based on on the ble_app_template PCA10040e S112 (The final chip will be a NRF52810 that's why I use the PCA10040e.)

I am trying to conform to the new nrfX module (compare to the previous nrf module).
Based on a clean ble_app_template  my aim is to run a timer + PPI.

I want to add static const nrfx_timer_t m_timer1 = NRFX_TIMER_INSTANCE(1); in my main.c
(previously it was : static const nrf_drv_timer_t m_timer1 = NRF_DRV_TIMER_INSTANCE(1);)

in sdk_config.h I then setup :
#define NRFX_TIMER_ENABLED 1
#define NRFX_TIMER1_ENABLED 1

I then add the nrfx_timer.c to "nrF driver" folder
I Add #include "nrfx_timer.h" in the main.c

If I compile, I have the following issue :
'NRFX_TIMER1_INST_IDX' undeclared here (not in a function)

If I go to the nrfx_timer.h NRFX_CHECK(NRFX_TIMER1_ENABLED) is not recognized and then that's why NRFX_TIMER1_INST_IDX, is not enumerated.

I do not understand why as I previously defined NRFX_TIMER_ENABLED 1 in the sdk_config.hI tried to clean the all project and build it again without success.Could you please explain me what is my mistake?Thanks

Parents
  • This happens if you have both TIMER_ENABLED and NRFX_TIMER_ENABLED defined in your sdk_config.h.

    If you want to use the new defines, find the location in sdk_config where TIMER_ENABLED is defined an remove it or comment it out. Then you can use the "NRFX_TIMERxxxxx" configuration.

    If you want to use the old defines, set the "TIMERxxxxxx" and leave all "NRFX_TIMERxxxxx" as they are.

    In general, this is true for all driver configurations. If you have both "<DRIVER>_ENABLED" and "NRFX_<DRIVER>_ENABLED" defined, the old define takes precedence. If you want the new defines, you must remove (or comment out) "<DRIVER>_ENABLED" from sdk_config.

  • After taking the generic file "sdk/nrf5/config/nrf52840/config/sdk_config.h", i got the same problem. Would it be better to remove the old configuration in the generic file to avoid similar problem for people taking those files provided in the SDK ?

Reply Children
  • Or, at least, to clearly document that the two sets of definitions are mutually exclusive.

    I had to waste a lot of time battling against this kind of thing.

    Perhaps it could be automatically detected in the sdk_config.h; eg,

    #if defined( <DRIVER>_ENABLED ) && defined( NRFX_<DRIVER>_ENABLED )
    #error "Define *either* <DRIVER>_ENABLED *or* NRFX_<DRIVER>_ENABLED - not both!"
    // (add further explanation here, and/or pointers to relevant documentation)
    #endif

Related