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

Issue with adding TWI(i2c) functions from example to own project

Hi,

I'm using SDK 15.0.0; nrf52840 DK; IAR(EWARM).

I want to add TWI(i2c) from example in SDK to my project.

But I facing with next errors:

Error[Li005]: no definition for "nrfx_twim_enable" [referenced from D:\Projects\NRF52\MyProject\application\iar\_build\i2c_module.o]

Error[Li005]: no definition for "nrfx_twim_init" [referenced from D:\Projects\NRF52\MyProject\application\iar\_build\nrf_drv_twi.o]

Error while running Linker

1) I have added all headers from TWI example to my .c file:

#include "nrf_gpio.h"
#include "boards.h"
#include "app_util_platform.h"
#include "app_error.h"
#include "nrf_drv_twi.h"
#include "nrf_delay.h"


#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"

2) I have set additional pathes in C/C++ Preprocessor (here is not full list, just all that was new in TWI example)

$PROJ_DIR$\..\..\..\..\..\..\integration\nrfx
$PROJ_DIR$\..\..\..\..\..\..\integration\nrfx\legacy
$PROJ_DIR$\..\..\..\..\..\..\modules\nrfx
$PROJ_DIR$\..\..\..\..\..\..\modules\nrfx\drivers\include
$PROJ_DIR$\..\..\..\..\..\..\modules\nrfx\hal
$PROJ_DIR$\..\..\..\..\..\..\modules\nrfx\mdk
$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\nrf_soc_nosd

3) In sdk_config.h I have changed:

#ifndef NRFX_TWIM_ENABLED
#define NRFX_TWIM_ENABLED 1//0
#endif

#ifndef TWI_ENABLED
#define TWI_ENABLED 1//0
#endif

#ifndef TWI0_ENABLED
#define TWI0_ENABLED 1//0
#endif

#ifndef TWI0_USE_EASY_DMA
#define TWI0_USE_EASY_DMA 1//0
#endif

4) I have added nrf_drv_twi.c file in project's folder nRF_Drivers (I can open this file without issues):

Please advice what else should I do?

Regards!

Related