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

IAR Error[Pe020]: identifier "NRFX_TIMER1_INST_IDX" is undefined

Hello,

I am using the NRF52-DK softdevice 6.0.0 and NRF SDK 15.0.The app is based on on the saadc PCA10040 S112. I want to add static const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(1); in my main.c 

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

If I compile, I have the following issue :
Error[Pe020]: identifier "NRFX_TIMER1_INST_IDX" is undefined

Could you please explain me what is my mistake?Thanks

Parents
  • Try to set TIMER_ENABLED and TIMER1_ENABLED to 1 instead:

    #ifndef TIMER_ENABLED
    #define TIMER_ENABLED 1
    #endif
    .
    .
    .
    #ifndef TIMER1_ENABLED
    #define TIMER1_ENABLED 1
    #endif

    Best regards, Simon

  • Why do you recommend this "work around"?

    Is the NRFX_TIMER API not ready to use?

    In the file nrfx_timer.h the NRFX_TIMER1 _INST_IDX is concated with NRFX_CONCAT_3(NRFX_TIMER, id, _INST_IDX), but the enum is defined in the following enum!

    Please advise

    /**
     * @brief Macro for creating a timer driver instance.
     */
    #define NRFX_TIMER_INSTANCE(id)                                   \
    {                                                                 \
        .p_reg            = NRFX_CONCAT_2(NRF_TIMER, id),             \
        .instance_id      = NRFX_CONCAT_3(NRFX_TIMER, id, _INST_IDX), \
        .cc_channel_count = NRF_TIMER_CC_CHANNEL_COUNT(id),           \
    }
    
    enum {
    #if NRFX_CHECK(NRFX_TIMER0_ENABLED)
        NRFX_TIMER0_INST_IDX,
    #endif
    #if NRFX_CHECK(NRFX_TIMER1_ENABLED)
        NRFX_TIMER1_INST_IDX,
    #endif
    #if NRFX_CHECK(NRFX_TIMER2_ENABLED)
        NRFX_TIMER2_INST_IDX,
    #endif
    #if NRFX_CHECK(NRFX_TIMER3_ENABLED)
        NRFX_TIMER3_INST_IDX,
    #endif
    #if NRFX_CHECK(NRFX_TIMER4_ENABLED)
        NRFX_TIMER4_INST_IDX,
    #endif
        NRFX_TIMER_ENABLED_COUNT
    };
    

  • The definitions TIMER_ENABLED and TIMER1_ENABLED originates from older SDK's, but the Timer driver in SDK 15 uses NRFX definitions. 

    The reason it fails, is due to the file apply_old_config.h (located in integration/nrfx/legacy) and the following lines:

    #if defined(TIMER_ENABLED)
    #undef NRFX_TIMER_ENABLED
    #define NRFX_TIMER_ENABLED  TIMER_ENABLED
    .
    .
    .
    .
    #if defined(TIMER1_ENABLED)
    #undef NRFX_TIMER1_ENABLED
    #define NRFX_TIMER1_ENABLED  TIMER1_ENABLED
    #endif

    This will make your project to use the old definitions (not NRFX) in the sdk_config.h file.

    Two ways of solving this:

    • My initial suggestion
    • Use the new definitions (NRFX_TIMER_ENABLED and NRFX_TIMER1_ENABLED) in the sdk config file, and delete/comment out the old definitions (TIMER_ENABLED and TIMER1_ENABLED) to prevent it from being overwritten

    Does this make sense?

    Best regards, Simon

Reply
  • The definitions TIMER_ENABLED and TIMER1_ENABLED originates from older SDK's, but the Timer driver in SDK 15 uses NRFX definitions. 

    The reason it fails, is due to the file apply_old_config.h (located in integration/nrfx/legacy) and the following lines:

    #if defined(TIMER_ENABLED)
    #undef NRFX_TIMER_ENABLED
    #define NRFX_TIMER_ENABLED  TIMER_ENABLED
    .
    .
    .
    .
    #if defined(TIMER1_ENABLED)
    #undef NRFX_TIMER1_ENABLED
    #define NRFX_TIMER1_ENABLED  TIMER1_ENABLED
    #endif

    This will make your project to use the old definitions (not NRFX) in the sdk_config.h file.

    Two ways of solving this:

    • My initial suggestion
    • Use the new definitions (NRFX_TIMER_ENABLED and NRFX_TIMER1_ENABLED) in the sdk config file, and delete/comment out the old definitions (TIMER_ENABLED and TIMER1_ENABLED) to prevent it from being overwritten

    Does this make sense?

    Best regards, Simon

Children
Related