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

LIS2DH integration I2C

Hi,

 Not directly related to Nordic, but I as many people are doing the same I figured it's fine.

is there any reason why this would not work? assuming the I2C is already working with another sensor and assuming no HW bug

LI2DH datasheet command WHO_I_AM_VALUE 0x33

uint8_t acc_i2c_rx[4];
uint8_t acc_i2c_tx[4];
acc_i2c_tx[0]= 0X33;
acc_i2c_tx[1]= 0x00;
err_code = nrf_drv_twi_tx(&m_twi_mx31875, 0x19, acc_i2c_tx, 1, false);
APP_ERROR_CHECK(err_code);
while(nrf_drv_twi_is_busy(&m_twi_mx31875));

err_code = nrf_drv_twi_rx(&m_twi_mx31875, 0x19, acc_i2c_rx, 2);
APP_ERROR_CHECK(err_code);
while(nrf_drv_twi_is_busy(&m_twi_mx31875));

Related