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

undefined reference nrf_twi_mngr_init/schedule

Thank you for taking time to look at my problem!

I have managed to combine the TDK/Invensense library for their IMU MPU9250 within the SDK 15 utilizing simple TWI calls, but when attempting to utilize TWI manager the compiler errors: 

C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc>make
Linking target: _build/nrf52832_xxaa.out
_build/nrf52832_xxaa/tdk_ERmini.c.o: In function `ERmini_init':
C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../tdk_ERmini.c:72: undefined reference to `nrf_twi_mngr_init'
_build/nrf52832_xxaa/tdk_ERmini.c.o: In function `mpu_i2c_write':
C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../tdk_ERmini.c:112: undefined reference to `nrf_twi_mngr_schedule'
_build/nrf52832_xxaa/tdk_ERmini.c.o: In function `mpu_i2c_read':
C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../tdk_ERmini.c:139: undefined reference to `nrf_twi_mngr_schedule'
collect2.exe: error: ld returned 1 exit status

The development is done through text editors and command line with make and gcc. I have the nrf_twi_mngr.h included in the tdk_ERmini.h file and the make file has the source and the include folder added.

I think I have attached the complete project.

MPUmanagedTWI.zip

  • While not everyone gets to make changes to their arch nemesis, mine is available to me to be hacked: sdk_config.h. The makefile and the sdk_config were inadequate in my application. I compared the makefile and the sdk_config.h of the example project twi_master_using_nrf_mngr and have gotten a little farther.

    My understanding between nrf_ and nrfx_ is that it SDK version uprade from SDK14 to SDK15, maybe? So I am working in SDK15.0 and the example is using some nrf_ references? But upon compiling: it does not recognize function calls to: 

    C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc>makeLinking target: _build/nrf52832_xxaa.out
    _build/nrf52832_xxaa/nrf_twi_mngr.c.o: In function `nrf_drv_twi_xfer':C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../../../../integration/nrfx/legacy/nrf_drv_twi.h:608: undefined reference to `nrfx_twi_xfer'
    _build/nrf52832_xxaa/nrf_twi_mngr.c.o: In function `nrf_drv_twi_uninit':
    C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../../../../integration/nrfx/legacy/nrf_drv_twi.h:504: undefined reference to `nrfx_twi_uninit'
    _build/nrf52832_xxaa/nrf_twi_mngr.c.o: In function `nrf_drv_twi_enable':
    C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../../../../integration/nrfx/legacy/nrf_drv_twi.h:517: undefined reference to `nrfx_twi_enable'
    _build/nrf52832_xxaa/nrf_twi_mngr.c.o: In function `nrf_drv_twi_xfer':
    C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../../../../integration/nrfx/legacy/nrf_drv_twi.h:608: undefined reference to `nrfx_twi_xfer'
    _build/nrf52832_xxaa/nrf_twi_mngr.c.o: In function `nrf_drv_twi_enable':
    C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../../../../integration/nrfx/legacy/nrf_drv_twi.h:517: undefined reference to `nrfx_twi_enable'
    _build/nrf52832_xxaa/nrf_drv_twi.c.o: In function `nrf_drv_twi_init':
    C:\Nordic\nRF5_SDK_15.0.0\examples\peripheral\MPUmanagedTWI\pca10040\blank\armgcc/../../../../../../integration/nrfx/legacy/nrf_drv_twi.c:186: undefined reference to `nrfx_twi_init'
    collect2.exe: error: ld returned 1 exit status
    make: *** [_build/nrf52832_xxaa.out] Error 1

    Seems like the example maybe using a little of the old a little of the new mixing and serving them up for my enjoyment, thanks Nordic, I appreciate that you are giving me an alternative to sudko!

    Is there some sort of #define necessary to get the nrf_ and the nrfx_ to play nicely together?

  • Hi,

    You were missing a few source files and some defines in sdk_config.h. I have updated both so you should be able to compile but wasn't able to upload it here so uploaded it to dropbox: https://www.dropbox.com/s/3sgc4bi02fgw7np/Makefile_and_sdk_config.zip?dl=0 

    The following links provide some background/motivation for introducing the nrfx if you are interested:

     - Migration document

     - nrfx git repo

Related