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

Getting I2C/TWI working?

There seems to be 3 different libraries that can be used to access TWI: nrf_drv_twi, twi_hw_master, twi_sw_master. (please correct if i am wrong).

i am using SDK8.1. Which library is the most stable?

Is there any example code i could learn from?

thank you.

Parents
  • twi_hw_master : Driver for TWI master that uses TWI hardware in nRF chip

    twi_sw_master : driver for TWI master that does not use TWI hardware but uses GPIO to bitbang the protocol.

    both of the above are marked as incubated in SDK8.1 and most probably will be depreciated in the future releases. Marking incubated is the way to tell you that support will be stopped for these modules soon.

    nrf_drv_twi: New Driver released in SDK8.1 for TWI hardware module for abstracting the TWI hardware in the chip. This module must be used for new development.

  • Again, thank you. I hope this is my last ? for now...and next twi is working. I've gotten the twi example to build/load. What I am not sure of is which gpio pins are being used for SCL and SDA. With twi_master, this is in twi_master_config.h. This include file is not part of the nrf_drv_twi. Rather, there is nrf_drv_config.h. I copied the twi section over and changed to TWIO_ENABLED 1. This means TWIO_CONFIG_SCL 0...but i am not sure where this gets mapped to a gpio pin? (I apologize up front if this is a n00b question).

Reply
  • Again, thank you. I hope this is my last ? for now...and next twi is working. I've gotten the twi example to build/load. What I am not sure of is which gpio pins are being used for SCL and SDA. With twi_master, this is in twi_master_config.h. This include file is not part of the nrf_drv_twi. Rather, there is nrf_drv_config.h. I copied the twi section over and changed to TWIO_ENABLED 1. This means TWIO_CONFIG_SCL 0...but i am not sure where this gets mapped to a gpio pin? (I apologize up front if this is a n00b question).

Children
No Data
Related