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

undefined reference to `nrfx_twi_tx'

Hello,

I have a twi module developped using sdk v13. I want to upgrade it to the sdk 15 to integrate it to a mesh project.

I changed all nrf_drv functions to nrfx same with structures.

I enabled TWI in sdk_config.h

i added the following path to my project:

$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/softdevice/s132/headers/
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/softdevice/s132/headers/nrf52/
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx/mdk
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx/hal
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx/drivers
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx/drivers/includes
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx/templates/nRF52832
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/toolchain/cmsis/include
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/toolchain/gcc
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/toolchain/cmsis/dsp/GCC
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/boards
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/integration/nrfx
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/log
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/util
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/delay
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/integration/nrfx/legacy
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/modules/nrfx/drivers/include
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/external/custom_mesh_utilities
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/experimental_log
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/experimental_log/src
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/experimental_section_vars
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/experimental_memobj
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/balloc
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/bsp
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/components/libraries/button
$(SDK_ROOT:../../../../nRF5_SDK_15.0.0_a53641a)/config/nrf52832/config

I still get the error undefined reference to `nrfx_twi_tx'

Any idea of what I am doing wrong?

I am using SES.

Thank you for helping.

Regards,

Mickael

Parents Reply Children
  • I tried with NRFX_TWIM_INSTANCE(0) as you suggested.

    I included "nrfx_twim.h", and changed the functions and structures from nrfx_twi to nrfx_twim.

    I'm back with "undefined reference to `nrfx_twim_tx'".

    I have NRFX_TWIM_ENABLED and NRFX_TWIM0_ENABLED at the moment, as well as NRFX_TWI_ENABLED and NRFX_TWI0_ENABLED

  • Hi,

    Looks like the TWI legacy configuration needs to be kept, otherwise the NRFX_TWIM_* configurations get undefined by the legacy to nrfx 'translation' layer (apply_old_config.h), hence causing to the undefined reference errors. This is probably not the intended behavior, and have reported it as a bug internally. 

    The configurations below should work if you ise TWIM 0. Notice that both TWI_ENABLED and NRFX_TWIM_ENABLED are set to '1'

    // <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 1
    #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 7
    #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>
    
    // <q> NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED  - Enables nRF52 anomaly 109 workaround for TWIM.
     
    
    // <i> The workaround uses interrupts to wake up the CPU by catching
    // <i> the start event of zero-frequency transmission, clear the 
    // <i> peripheral, set desired frequency, start the peripheral, and
    // <i> the proper transmission. See more in the Errata document or
    // <i> Anomaly 109 Addendum located at https://infocenter.nordicsemi.com/
    
    #ifndef NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED
    #define NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0
    #endif
    
    // <e> TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver - legacy layer
    //==========================================================
    #ifndef TWI_ENABLED
    #define TWI_ENABLED 1
    #endif
    // <o> TWI_DEFAULT_CONFIG_FREQUENCY  - Frequency
     
    // <26738688=> 100k 
    // <67108864=> 250k 
    // <104857600=> 400k 
    
    #ifndef TWI_DEFAULT_CONFIG_FREQUENCY
    #define TWI_DEFAULT_CONFIG_FREQUENCY 26738688
    #endif
    
    // <q> TWI_DEFAULT_CONFIG_CLR_BUS_INIT  - Enables bus clearing procedure during init
     
    
    #ifndef TWI_DEFAULT_CONFIG_CLR_BUS_INIT
    #define TWI_DEFAULT_CONFIG_CLR_BUS_INIT 0
    #endif
    
    // <q> TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT  - Enables bus holding after uninit
     
    
    #ifndef TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT
    #define TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
    #endif
    
    // <o> TWI_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef TWI_DEFAULT_CONFIG_IRQ_PRIORITY
    #define TWI_DEFAULT_CONFIG_IRQ_PRIORITY 7
    #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>
    
    // <e> TWI1_ENABLED - Enable TWI1 instance
    //==========================================================
    #ifndef TWI1_ENABLED
    #define TWI1_ENABLED 0
    #endif
    // <q> TWI1_USE_EASY_DMA  - Use EasyDMA (if present)
     
    
    #ifndef TWI1_USE_EASY_DMA
    #define TWI1_USE_EASY_DMA 0
    #endif
    
    // </e>
    
    // <q> TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED  - Enables nRF52 anomaly 109 workaround for TWIM.
     
    
    // <i> The workaround uses interrupts to wake up the CPU by catching
    // <i> the start event of zero-frequency transmission, clear the 
    // <i> peripheral, set desired frequency, start the peripheral, and
    // <i> the proper transmission. See more in the Errata document or
    // <i> Anomaly 109 Addendum located at https://infocenter.nordicsemi.com/
    
    #ifndef TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED
    #define TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0
    #endif
    
    // </e>
    
    // </e>

    More information about the translation layer can be found in the migration document here: https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/migration.html?cp=4_0_0_1_9_4_0#migration_drivers_nrfx

     

     

  • Hi,

    If you want to use nrfx functions you need to remove all TWI (legacy) defines from sdk_config file. It is not enough to set TWI_ENABLE to 0.

  • This was not true for me. TWI_ENABLED 0 did not work. In fact, I had to TWI_ENABLED 1 and TWI_USE_EASY_DMA 1 to get things to compile, despite the fact that I'm attempting to use all nrfx_twim related methods and calls.

  • I just found this point. Why would you include both in the templates! What kind of amateur hour is this then?

Related