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
  • Hello,

    Could you confirm that you have added the path to the header file into your Project Options -> Common Configuration -> Preprocessor -> User Included Directories? Please also confirm that you have added the required source files to your project navigator.

    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.

    Yes, you will need to add the NRFX_TWI_ENABLED define to your sdk_config, and remove the TWI_ENABLED define.
    If the TWI_ENABLED define is present it will overwrite your nrfx_twi defines.

    You will also need to enable the specific TWI instance you intend to use.
    Could you share your sdk_config with me so that I may take a look?

    Best regards,
    Karl

Reply
  • Hello,

    Could you confirm that you have added the path to the header file into your Project Options -> Common Configuration -> Preprocessor -> User Included Directories? Please also confirm that you have added the required source files to your project navigator.

    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.

    Yes, you will need to add the NRFX_TWI_ENABLED define to your sdk_config, and remove the TWI_ENABLED define.
    If the TWI_ENABLED define is present it will overwrite your nrfx_twi defines.

    You will also need to enable the specific TWI instance you intend to use.
    Could you share your sdk_config with me so that I may take a look?

    Best regards,
    Karl

Children
No Data
Related