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

Adding twi support to ble_app_hrs_freertos

Hi,
I read so many articles but just can't find the correct way to add twi support to the ble_app_hrs_feertos app in the latest SDK15.
This what did:
- Copied 3 lines from twi_sensor example that define nrf_drv_twi_t object  just before my main (see screen cap)
- In sdk_config.h enabled NRFX_TWI_ENABLED & NRFX_TWI0_ENABLED
- Tried enabling nRF_Drivers\nrf_twi / nrf_drv_twi (whats the difference between the two?) in Keil's RTE manager
Nothing could get rid from the NRF_DRV_TWI_INSTANCE_0 undefined error.
Is there any guide how to integrate and use nrf drivers in general and twi in particular?  Specifically what to include and how (sdk_config.h? RTE ? both ?)
Thanks
Parents
  • In SDK14.2 it works fine !

    - Included  #include "nrf_drv_twi.h"

    - added nrf_drv_twi.c from <SDK142 folder>\components\drivers_nrf\twi_master to nRF_Drivers group

    - In sdk_config.h enabled TWI_ENABLE & TWI0_ENABLED

    - Add twi init code

    Voilla, compiles without errors

  • I think there is an error in this file apply_old_config.h

    it is:

    #if defined(TWI_ENABLED)
    
    #undef NRFX_TWI_ENABLED
    #define NRFX_TWI_ENABLED   (TWI_ENABLED && (NRFX_TWI0_ENABLED  || NRFX_TWI1_ENABLED))
    

    but in sdk_config.h is

    #define TWI_ENABLED 0

    which actually DEFINES but does not ENABLES the preprocessor defines TWI_ENABLED

    Correct should be:

    #if TWI_ENABLED
    
    #undef NRFX_TWI_ENABLED
    #define NRFX_TWI_ENABLED   (TWI_ENABLED && (NRFX_TWI0_ENABLED  || NRFX_TWI1_ENABLED))
    

    And so there comes this misunderstanding. ....

    I hope this will be fixed.

    Regards, Adib.

Reply
  • I think there is an error in this file apply_old_config.h

    it is:

    #if defined(TWI_ENABLED)
    
    #undef NRFX_TWI_ENABLED
    #define NRFX_TWI_ENABLED   (TWI_ENABLED && (NRFX_TWI0_ENABLED  || NRFX_TWI1_ENABLED))
    

    but in sdk_config.h is

    #define TWI_ENABLED 0

    which actually DEFINES but does not ENABLES the preprocessor defines TWI_ENABLED

    Correct should be:

    #if TWI_ENABLED
    
    #undef NRFX_TWI_ENABLED
    #define NRFX_TWI_ENABLED   (TWI_ENABLED && (NRFX_TWI0_ENABLED  || NRFX_TWI1_ENABLED))
    

    And so there comes this misunderstanding. ....

    I hope this will be fixed.

    Regards, Adib.

Children
No Data
Related