This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Undefined symbol nrf_drv_twi_init (referred from main.o).

Hello, I am using pca10028 and sdk12.2. I am trying to take sensor reading via TWI and I want to send this reading over ble. So I am trying to add twi files in ble_app_template project. After adding TWI file I am getting error such as :

L6218E: Undefined symbol nrf_drv_twi_enable (referred from main.o). L6218E: Undefined symbol nrf_drv_twi_init (referred from main.o).

I have enabled #define TWI1_ENABLED 1 and #define TWI0_ENABLED 1 from sdk_config.h app. I have also included paths like: components\drivers_nrf\twi_master

My code is attached below:

main.c

New Text Document.txt

Thanks, Shailav

  • Hello shailav619

    I have looked at your code. You can remove the line

    #include "nrf_drv_twi.c"
    

    As it is not necessary.

    Instead you need to add the nrf_drv_twi.c file to the project. You can find this file in the directory located at [SDK-Folder]/components/drivers_nrf/twi_master

    If you are using Keil simply double click on the nRF_drivers folder in the left hand side folder-tree, and add the file through the window that opens.

    Next go into sdk_config.h, and click on the configuration wizard tab. Here check the box next to TWI_ENABLED, and inside the TWI_ENABLED tree check the box next to TWI0_ENABLED.

    If you're not using Keil you will need to make the corresponding changes in the sdk_config.h file manually by setting the TWI_ENABLED and TWI0_ENABLED to 1.

    Best regards

    Jørn Frøysa

  • Thanks Jørn Frøysa. It worked :)

Related