Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Combind examples ble_pripheral and twi_sensor

Hello all,

I'm using nRF5_SDK_17.1.0_ddde560

Examples folder:

  • ...\nRF5_SDK_17.1.0_ddde560\examples\peripheral\twi_sensor
  • ...\ble_peripheral\ble_app_blinky

Are what I'm trying to combined, both compile fine separate using Segger embedded studio for ARM V5.42 (64-Bit)

Yet when customizing the main.c to include twi_sensor, TWI instance Error arises:

  • 'NRFX_TWIM0_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TWIM_INSTANCE'?

Now I've made sure the emProject contains the required Segger Startup Files, c_user_include_directories and c_preprocessor_definitions

The ble_app_blinky contains all the required sdk_config settings though to make sure I also included twi_sensor sdk_config though no errors/warnings arise for duplicate

Regardless of my efforts I cannot get both working together any thoughts?

Parents
  • Note I have made sure I comply with nrfx_twim.c eg. #if NRFX_CHECK(NRFX_TWIM_ENABLED)

  • Hi Chris56945,

    What are the current values of these configurations in your projects?

    TWI_ENABLED
    TWI0_ENABLED
    NRFX_TWI0_ENABLED

    There is some complication due to the nRF5 SDK supporting both an old driver system (TWI_ENABLED) and the new nrfx driver system (NRFX_TWIM_ENABLED). There are two potential issues here.

    The first one is that you are enabling only one driver system and haven't enabled TWIM0 on it.

    The second one is that you are enabling both driver systems, and TWI0_ENABLED is set to 0. In this case, the legacy driver system overrides the nrfx configurations (ref apply_old_config.h), causing the build issue.

    Hieu

  • Thankyou for your kind reply Hieu,

    Currently in my BLE and TWI project sdk_config.h
    TWI_ENABLED 1

    TWI0_ENABLED 1
    NRFX_TWI0_ENABLED 1

    In the TWI Sensor example sdk_config I set:

    TWI_ENABLED 0
    TWI0_ENABLED 0
    NRFX_TWI0_ENABLED 0
    Yet "cannot" reproduce the error 'NRFX_TWIM0_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TWIM_INSTANCE'?

    In the BLE and TWI project however I also get some hints case these are of any use
    in definition of macro 'NRFX_CONCAT_3_'
    in expansion of macro 'NRFX_CONCAT_3'
    in expansion of macro 'NRFX_TWIM_INSTANCE'
    As for the legacy apply_old_config.h it is not being used, but regardless I also enabled settings to make sure, without success.

    Something to note is when building the Code and DATA+RO does not get populated on the nrfx_twim.c in project items I can only assume this is related to the error 'NRFX_TWIM0_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TWIM_INSTANCE'?

  • Update after careful reading I relised I had indeed enabled both the old driver system (TWI_ENABLED) much appreciated for you help.

Reply Children
No Data
Related