Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

error: #20: identifier "NRF_DRV_TWI_INSTANCE_0" is undefined but defined in SDK_config.h

Hello,

At the following line

const static nrf_drv_twi_t m_twi_master = NRF_DRV_TWI_INSTANCE(MASTER_TWI_INST);

I get the error:

hal.c(35): error:  #20: identifier "NRF_DRV_TWI_INSTANCE_0" is undefined

When looking further it seems likein the following code from nrf_drv_twi.h is greyed out

#define NRF_DRV_TWI_INSTANCE(id)    NRF_DRV_TWI_INSTANCE_(id)
#define NRF_DRV_TWI_INSTANCE_(id)   NRF_DRV_TWI_INSTANCE_ ## id
#if NRFX_CHECK(NRFX_TWIM0_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_0 \
        { 0, { .twim = NRFX_TWIM_INSTANCE(0) }, true }
#elif NRFX_CHECK(NRFX_TWI0_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_0 \
        { 0, { .twi = NRFX_TWI_INSTANCE(0) }, false }
#endif
#if NRFX_CHECK(NRFX_TWIM1_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_1 \
        { 1, { .twim = NRFX_TWIM_INSTANCE(1) }, true }
#elif NRFX_CHECK(NRFX_TWI1_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_1 \
        { 1, { .twi = NRFX_TWI_INSTANCE(1) }, false }
#endif

When I go even further and look in my SDK_config.h I can clearly see that all TWI and TWIS and TWIM entries are set to 1 and the instances are also set to 1:

// <e> NRFX_TWI_ENABLED - nrfx_twi - TWI peripheral driver
//==========================================================
#ifndef NRFX_TWI_ENABLED
#define NRFX_TWI_ENABLED 1
#endif
// <q> NRFX_TWI0_ENABLED  - Enable TWI0 instance
 

#ifndef NRFX_TWI0_ENABLED
#define NRFX_TWI0_ENABLED 1
#endif

What else can be the problem?

Parents Reply Children
Related