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

Linker error: undefined reference to 'nrfx_twim_xfer'

Hello, how can I use the functions in nrfx_twim.c

Using SES and the CMSIS config wizard, I have picked:

NRFX_TWIM_ENABLED 1

NRFX_TWIM0_ENABLED 1

NRFX_TWIS_ENABLED 0

NRFX_TWI_ENABLED 0

TWIS_ENABLED 0

TWI_ENABLED 0

In the IDE, the source for nrfx_twim.c is all 'greyed out'.

Parents Reply Children
  • Your sdk_config file should be similar to the TWIM example from the SDK. I suggest comparing the two:

    // <e> NRFX_TWIM_ENABLED - nrfx_twim - TWIM peripheral driver
    //==========================================================
    #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 0
    #endif
    
    // <q> NRFX_TWIM1_ENABLED  - Enable TWIM1 instance
     
    
    #ifndef NRFX_TWIM1_ENABLED
    #define NRFX_TWIM1_ENABLED 0
    #endif
    
    // <o> NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY  - Frequency
     
    // <26738688=> 100k 
    // <67108864=> 250k 
    // <104857600=> 400k 
    
    #ifndef NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY
    #define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY 26738688
    #endif
    
    // <q> NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT  - Enables bus holding after uninit
     
    
    #ifndef NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT
    #define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
    #endif
    
    // <o> NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY
    #define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // <e> NRFX_TWIM_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRFX_TWIM_CONFIG_LOG_ENABLED
    #define NRFX_TWIM_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRFX_TWIM_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRFX_TWIM_CONFIG_LOG_LEVEL
    #define NRFX_TWIM_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRFX_TWIM_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_TWIM_CONFIG_INFO_COLOR
    #define NRFX_TWIM_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRFX_TWIM_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_TWIM_CONFIG_DEBUG_COLOR
    #define NRFX_TWIM_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // </e>
    
    // <e> NRFX_TWIS_ENABLED - nrfx_twis - TWIS peripheral driver
    //==========================================================
    #ifndef NRFX_TWIS_ENABLED
    #define NRFX_TWIS_ENABLED 1
    #endif
    // <q> NRFX_TWIS0_ENABLED  - Enable TWIS0 instance
     
    
    #ifndef NRFX_TWIS0_ENABLED
    #define NRFX_TWIS0_ENABLED 0
    #endif
    
    // <q> NRFX_TWIS1_ENABLED  - Enable TWIS1 instance
     
    
    #ifndef NRFX_TWIS1_ENABLED
    #define NRFX_TWIS1_ENABLED 0
    #endif
    
    // <q> NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY  - Assume that any instance would be initialized only once
     
    
    // <i> Optimization flag. Registers used by TWIS are shared by other peripherals. Normally, during initialization driver tries to clear all registers to known state before doing the initialization itself. This gives initialization safe procedure, no matter when it would be called. If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives more optimal code.
    
    #ifndef NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY
    #define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
    #endif
    
    // <q> NRFX_TWIS_NO_SYNC_MODE  - Remove support for synchronous mode
     
    
    // <i> Synchronous mode would be used in specific situations. And it uses some additional code and data memory to safely process state machine by polling it in status functions. If this functionality is not required it may be disabled to free some resources.
    
    #ifndef NRFX_TWIS_NO_SYNC_MODE
    #define NRFX_TWIS_NO_SYNC_MODE 0
    #endif
    
    // <o> NRFX_TWIS_DEFAULT_CONFIG_ADDR0 - Address0 
    #ifndef NRFX_TWIS_DEFAULT_CONFIG_ADDR0
    #define NRFX_TWIS_DEFAULT_CONFIG_ADDR0 0
    #endif
    
    // <o> NRFX_TWIS_DEFAULT_CONFIG_ADDR1 - Address1 
    #ifndef NRFX_TWIS_DEFAULT_CONFIG_ADDR1
    #define NRFX_TWIS_DEFAULT_CONFIG_ADDR1 0
    #endif
    
    // <o> NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL  - SCL pin pull configuration
     
    // <0=> Disabled 
    // <1=> Pull down 
    // <3=> Pull up 
    
    #ifndef NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL
    #define NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL 0
    #endif
    
    // <o> NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL  - SDA pin pull configuration
     
    // <0=> Disabled 
    // <1=> Pull down 
    // <3=> Pull up 
    
    #ifndef NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL
    #define NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL 0
    #endif
    
    // <o> NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY
    #define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // <e> NRFX_TWIS_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRFX_TWIS_CONFIG_LOG_ENABLED
    #define NRFX_TWIS_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRFX_TWIS_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRFX_TWIS_CONFIG_LOG_LEVEL
    #define NRFX_TWIS_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRFX_TWIS_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_TWIS_CONFIG_INFO_COLOR
    #define NRFX_TWIS_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRFX_TWIS_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <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 0
    #endif
    
    // <q> NRFX_TWI1_ENABLED  - Enable TWI1 instance
     
    
    #ifndef NRFX_TWI1_ENABLED
    #define NRFX_TWI1_ENABLED 0
    #endif
    
    // <o> NRFX_TWI_DEFAULT_CONFIG_FREQUENCY  - Frequency
     
    // <26738688=> 100k 
    // <67108864=> 250k 
    // <104857600=> 400k 
    
    #ifndef NRFX_TWI_DEFAULT_CONFIG_FREQUENCY
    #define NRFX_TWI_DEFAULT_CONFIG_FREQUENCY 26738688
    #endif
    
    // <q> NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT  - Enables bus holding after uninit
     
    
    #ifndef NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT
    #define NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
    #endif
    
    // <o> NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY
    #define NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // <e> NRFX_TWI_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRFX_TWI_CONFIG_LOG_ENABLED
    #define NRFX_TWI_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRFX_TWI_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRFX_TWI_CONFIG_LOG_LEVEL
    #define NRFX_TWI_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRFX_TWI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_TWI_CONFIG_INFO_COLOR
    #define NRFX_TWI_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRFX_TWI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_TWI_CONFIG_DEBUG_COLOR
    #define NRFX_TWI_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // </e>
    

  • I found the combination. You have to pick

    TWI_ENABLED 1

    TWI0_ENABLED 1

    TWI0_USE_EASY_DMA 1

    NRFX_TWIM_ENABLED 1

    NRFX_TWIM0_ENABLED 1

Related