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

  • Yes you have understood it correctly. 

    In these cases TIMER_ENABLED IS defined:

    • #define TIMER_ENABLED 0
    • #define TIMER_ENABLED
    • #define TIMER_ENABLED 1

    The code inside #if defined(TIMER_ENABLED) will be executed

    In this case TIMER_ENABLED IS NOT defined:

    • //#define TIMER_ENABLED 0

    The code inside #if defined(TIMER_ENABLED) will not be executed

    Best regards,

    Simon

  • I am having this same issue, porting the saadc_pcs10056e example to the ble_app_hts_pca10056e_s112 using SDK 15.3 and SES. I am trying to use TIMER1 since I have read that TIMER0 is used by the Soft device. Regardless of how I configure the sdk_config.h file, either using the legacy or nrfx timers, the associated timer definition block in the nrfx_timer.h fails to be enumerated. I have the configuration file exactly the same as in the saadc example, but for TIMER1, and it doesn't seem to work. Some help trouble shooting would be greatly appreciated.

  • I assume you mean this block:

    enum {
    .
    .
    .
    #if NRFX_CHECK(NRFX_TIMER1_ENABLED)
        NRFX_TIMER1_INST_IDX,
    #endif
    .
    .
    .
    };

    • In order for NRFX_TIMER1_INST_IDX to be enabled, the macro NRFX_TIMER1_ENABLED has to equal 1
    • If you look in apply_old_config.h, NRFX_TIMER1_ENABLED is set in the following manner:

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

    • So you have to set both TIMER_ENABLED and TIMER1_ENABLED in the sdk_config.h file

    Okay, I see now that I have just repeated my earlier answers. But could you start at nrfx_timer.h and go backwards, to see specifically where it fails. Is the if statement grayed out in nrfx_timer.h or in apply_old_config.h?

    Best regards,

    Simon

Related