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

error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here

I'm trying to enable TWI in the eddystone example based on this article but I get the following compilation error:

nrfx/legacy/nrf_drv_twi.h:120:37: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here (not in a function)
main.c
#include "nrf_drv_twi.h"

#define TWI_INSTANCE_ID 0
static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);

sdk_config.h

//==========================================================
#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


#ifndef TWI_ENABLED
#define TWI_ENABLED 1
#endif


// <e> TWI0_ENABLED - Enable TWI0 instance
//==========================================================
#ifndef TWI0_ENABLED
#define TWI0_ENABLED 1
#endif
// <q> TWI0_USE_EASY_DMA  - Use EasyDMA (if present)
 

#ifndef TWI0_USE_EASY_DMA
#define TWI0_USE_EASY_DMA 1
#endif

// </e>

//==========================================================
#ifndef NRFX_TWIM_ENABLED
#define NRFX_TWIM_ENABLED 1
#endif
// <q> NRFX_TWIM0_ENABLED  - Enable TWIM0 instance
 

#ifndef NRFX_TWIM0_ENABLED
#define NRFX_TWIM0_ENABLED 1
#endif

Added nrf_drv_twi.c to the project. 

I can compile the twi_sensor project so the issue must be in the configs.
Should I add anything else into the sdk_config.h to make the TWI work?


Related