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

LSM9DS1 + NRF52 + I2C Initialization and readings

Hi Guys,

I hope that you could help me with issue which can be observed in my new "nRF52 setup". I've connect LSM9DS1 sensor to NRF52 DK. The "twi_scanner" example from SDK has been used firstly to eliminate problems with physical connections - two addresses have been detected. After that "quick check", I've started writting a code. On this moment, I want only to read collected data related to gyroscope (e.g. placed in OUT_X_G register). I'm trying to do that by using such code:

static void lsm_read_data()
{
	m_xfer_done = false;
	ret_code_t err_code = nrf_drv_twi_rx(&m_twi, AG_ACC_X_L, &m_sample, sizeof(m_sample));
	APP_ERROR_CHECK(err_code);
}

Project is compiling without errors, but after flashing procedure I see error in putty console. I suspect initialization procedure of sensor which I've made basic on aldurino example. Could you help me with that ?

In attachment I'm sending main.c, and header file which is related to registers of LSM9DS1 sensor.

Best Regards, E.

main.c LSM9DS1Reg.h

Related