This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Twi interface

Which is the preferred way,  accessing sensor via the TWI

1) NRFX_Driver

2) TWI HAL 

what options do I need to select in the SDK_CONFIG.h to use the twi_driver api. 

Parents
  • The "abstraction flow" for accessing the twi peripherals (and the other peripherals) in SDK 15.x.x is the following:

    TWI driver (Legacy layer)TWI driver (NRFX)   → TWI HAL

    • The Legacy TWI driver is a glue layer that remaps to the NRFX functions (see this link for an explanation how it works)
      • It is not pure remapping, some functionality is added in between 
    • The NRFX TWI driver accesses the HAL driver, and makes it more simple to use the TWI HAL 
    • The TWI HAL accesses the TWI registers directly

    Unless you need complete control and flexibility of what you are doing I would not recommend you to use the TWI HAL, as it requires a lot of extra work. Regarding the choice of driver, there has been some discussion about this. However, I would recommend you to use the TWI driver, since all the examples in the SDK uses this and I think it will be less to troublesome. Also the legacy driver is more compatible with BLE functionality.

    In the sdk_config.h file, you should use the legacy definitions and ignore the NRFX definitions, as explained here.

    Best regards,

    Simon

Reply
  • The "abstraction flow" for accessing the twi peripherals (and the other peripherals) in SDK 15.x.x is the following:

    TWI driver (Legacy layer)TWI driver (NRFX)   → TWI HAL

    • The Legacy TWI driver is a glue layer that remaps to the NRFX functions (see this link for an explanation how it works)
      • It is not pure remapping, some functionality is added in between 
    • The NRFX TWI driver accesses the HAL driver, and makes it more simple to use the TWI HAL 
    • The TWI HAL accesses the TWI registers directly

    Unless you need complete control and flexibility of what you are doing I would not recommend you to use the TWI HAL, as it requires a lot of extra work. Regarding the choice of driver, there has been some discussion about this. However, I would recommend you to use the TWI driver, since all the examples in the SDK uses this and I think it will be less to troublesome. Also the legacy driver is more compatible with BLE functionality.

    In the sdk_config.h file, you should use the legacy definitions and ignore the NRFX definitions, as explained here.

    Best regards,

    Simon

Children
No Data
Related