Including drivers in my project

Development Kit: NRF52840

IDE: Segger Embedded Studios

I'm trying to use the nrf_drv_twi driver in my project. I've included the .c file in my nFR_Drivers folder. My base project is the uart_pca10056 example and I'm referencing the twi_sensor example for using TWI. When I build the project I get the error on my call to NRF_DRV_TWI_INSTANCE:

"NRF_DRV_TWI_INSTANCE_0 undeclared here (not in a function) did you mean 'NRF_DRV_TWI_INSTANCE_'?"I

I've read some discussions that I need to enable something in the sdk_config.h file but when I go to do that, I notice the file does not contain the nrf_drv_twi defines to do so.

I've tried copying the defines from the twi_sensor example into my sdk_config.h and that still does not solve the problem.

Parents
  • Hi Karl, 

    Here are the contents of my User Include Directories from the Project Options.

    ../../../config

    ../../../../../../components

    ../../../../../../components/boards

    ../../../../../../components/drivers_nrf/nrf_soc_nosd

    ../../../../../../components/libraries/atomic

    ../../../../../../components/libraries/balloc

    ../../../../../../components/libraries/bsp

    ../../../../../../components/libraries/delay

    ../../../../../../components/libraries/experimental_section_vars

    ../../../../../../components/libraries/fifo

    ../../../../../../components/libraries/log

    ../../../../../../components/libraries/log/src

    ../../../../../../components/libraries/memobj

    ../../../../../../components/libraries/ringbuf

    ../../../../../../components/libraries/strerror

    ../../../../../../components/libraries/uart

    ../../../../../../components/libraries/util

    ../../../../../../components/toolchain/cmsis/include

    ../../..

    ../../../../../../external/fprintf

    ../../../../../../integration/nrfx

    ../../../../../../integration/nrfx/legacy

    ../../../../../../modules/nrfx

    ../../../../../../modules/nrfx/drivers/include

    ../../../../../../modules/nrfx/hal

    ../../../../../../modules/nrfx/mdk

    ../config

    I tried adding these variations of the file path and still had the same error.

    ../../../../../../ntegration/nrfx/legacy

    ../../../../../../ntegration/nrfx/legacy/nrf_drv_twi

    ../../../../../../ntegration/nrfx/legacy/nrf_drv_twi_h

    I am not intentionally using TWI instead of TWIM. I am trying to communicate with a sensor via I2C and I read that TWI was the Nordic equivalent. Is TWIM better/easier to use than TWI?

    I am using the TWI0 instance. I am trying to define it like this:

    #define TWI_INSTANCE_ID 0

    static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID); 

    Thanks, 

    Jason

Reply
  • Hi Karl, 

    Here are the contents of my User Include Directories from the Project Options.

    ../../../config

    ../../../../../../components

    ../../../../../../components/boards

    ../../../../../../components/drivers_nrf/nrf_soc_nosd

    ../../../../../../components/libraries/atomic

    ../../../../../../components/libraries/balloc

    ../../../../../../components/libraries/bsp

    ../../../../../../components/libraries/delay

    ../../../../../../components/libraries/experimental_section_vars

    ../../../../../../components/libraries/fifo

    ../../../../../../components/libraries/log

    ../../../../../../components/libraries/log/src

    ../../../../../../components/libraries/memobj

    ../../../../../../components/libraries/ringbuf

    ../../../../../../components/libraries/strerror

    ../../../../../../components/libraries/uart

    ../../../../../../components/libraries/util

    ../../../../../../components/toolchain/cmsis/include

    ../../..

    ../../../../../../external/fprintf

    ../../../../../../integration/nrfx

    ../../../../../../integration/nrfx/legacy

    ../../../../../../modules/nrfx

    ../../../../../../modules/nrfx/drivers/include

    ../../../../../../modules/nrfx/hal

    ../../../../../../modules/nrfx/mdk

    ../config

    I tried adding these variations of the file path and still had the same error.

    ../../../../../../ntegration/nrfx/legacy

    ../../../../../../ntegration/nrfx/legacy/nrf_drv_twi

    ../../../../../../ntegration/nrfx/legacy/nrf_drv_twi_h

    I am not intentionally using TWI instead of TWIM. I am trying to communicate with a sensor via I2C and I read that TWI was the Nordic equivalent. Is TWIM better/easier to use than TWI?

    I am using the TWI0 instance. I am trying to define it like this:

    #define TWI_INSTANCE_ID 0

    static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID); 

    Thanks, 

    Jason

Children
No Data
Related