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

TWI Manager / Sensor interfacing with register-less sensor

Hi everyone,

I'm having trouble deciding on the "best" / "most sane" way to interface two I2C sensors with the nRF5832.

Both sensors are on the same I2C bus. The first sensor is well supported by the nRF52 SDK v15.0.0 with a driver using the TWI Manager and Sensor libraries.

The second sensor is as primitive as it gets (and as far as I have seen there is no driver in the nRF52 SDK):
    no registers
    to configure the sensor you write some command byte to the sensor's address
    to read some measurements, you send the appropriate command byte to the sensor's address, wait some time, and finally perform a read for x bytes on the sensor's address

So far I managed to interface both sensors separately: the first one with the provided driver, the second one using the nrf_twi_drv driver.

I've tried to port the first sensor's driver to the nrf_twi_drv driver which worked (but I'm not to fond of the idea to rewrite the nrf_twi_sensor based driver to use the nrf_twi_drv driver) and I also tried to expand the TWI Sensor library to cope with the absence of registers and the requirement to wait for a given time which wasn't as successful.

How do I interface them both at the same time, ideally with a single solution / way of interfacing?
    
Kind regards

lhochstetter

  • Hi Jared,

    thanks again for your input!

    But I think the best and safest option would be to base the MS5607 on the nrf_twi_mngr driver instead of the nrf_twi_drv. 

    I skimmed the nrf_twi_mngr documentation and noticed that you can actually perform quite "low level" I2C transactions (i.e. the nrf_twi_senor allows you only to read a register but not from an I2C address, but the nrf_twi_mngr seems to be less restrictive).

    This might be an option to interface both the MS5607 and the LIS2DH12 using the nrf_twi_mngr ... I'll definetly try!

    Thanks and kind regards

    lhochstetter

Related