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

Linking error with TWI in SAADC example code

Hi Nordic team,

I am trying to enable I2C driver in SAADC example which is located in examples\peripheral\saadc\pca10040\blank\arm5_no_packs

As you can see I am using Keil V5

This example is working perfectly. The issue is when I am trying to use TWI in this.

nrf_drv_twi.c, nrfx_twi.c and nrfx_twim.c are added to project.

sdk_config.h didn't have the option to enable TWI, so I added following to sdk_config.h

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// <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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Following is being included in the code

Fullscreen
1
2
3
#include "nrf_drv_twi.h"
#include "nrf_twi.h"
#include "nrf_twim.h"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have read through a lot of topics, everywhere above two solutions are suggested but I am still getting the following errors

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
linking...
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twi_init (referred from nrf_drv_twi.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol idle_state_handle (referred from i2c_control.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twi_disable (referred from i2c_control.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twi_enable (referred from i2c_control.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twi_rx (referred from i2c_control.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twi_tx (referred from i2c_control.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twi_uninit (referred from i2c_control.o).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 7 error messages.
".\_build\nrf52832_xxaa.axf" - 7 Error(s), 3 Warning(s).
Target not created.
Build Time Elapsed: 00:00:51
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Can someone please let me know where I am going wrong?