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

NRF_DRV_TWI_INSTANCE 0 undeclared error

hi.......... i am using nrf52832 and peripheral device , software -- segger 15.2 version

i am getting the error while merging uart and TWI sensor example program. this  is the error below 

'NRF_DRV_TWI_INSTANCE_0' undeclared here (not in a function)  .even i have add the nrf_drv_TWI.c file and h file also

i need the solution , suggest me

even i have changed the sdk.configur.h 

// <0=> Default 
// <1=> Black 
// <2=> Red 
// <3=> Green 
// <4=> Yellow 
// <5=> Blue 
// <6=> Magenta 
// <7=> Cyan 
// <8=> White 

#ifndef NRFX_TWIS_CONFIG_DEBUG_COLOR
#define NRFX_TWIS_CONFIG_DEBUG_COLOR 0
#endif

// </e>

// </e>

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

// <q> NRFX_TWI1_ENABLED  - Enable TWI1 instance
 

#ifndef NRFX_TWI1_ENABLED
#define NRFX_TWI1_ENABLED 0
#endif

  • Hi Saral,  you have posted an almost identical question, where you stete that you're using the nRF52840.

    https://devzone.nordicsemi.com/support-private/support/217837

    Are you using both the nRF52832 and the nRF52840? If not then we will close one of the questions and only answer one. 

    If the examples are using the legacy driver API, i.e. nrf_drv_twi_ etc, then you need to set the following definitions

    // <e> TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver - legacy layer
    //==========================================================
    #ifndef TWI_ENABLED
    #define TWI_ENABLED 0
    #endif 
    
    // <e> TWI0_ENABLED - Enable TWI0 instance
    //==========================================================
    #ifndef TWI0_ENABLED
    #define TWI0_ENABLED 0
    #endif

    and set the NRFX_TWI_ENABLED and NRFX_TWI0_ENABLED to 0.

    Best regards

    Bjørn 

Related