2016-04-10 10:56 AM
Hello Community,
I am currently trying to get my head around the LIS3DSH accelerometer using the I2C HAL library, however I am having a great deal off difficulty in achieving anything.My aim is to simply read the axes which seems straight forward using SPI, but when I attempt to do the same in I2C I am having no luck.I am currently using the linesdevice_Address = 0x1D;reg_Address = 0x20;
i2c_Data = 0x67;
HAL_I2C_Mem_Write(&hi2c1, device_Address, reg_Address, 1, &i2c_Data, 1, 200);to write to CTRL_REG4.And then reg_Address = 0x28;
HAL_I2C_Mem_Read(&hi2c1, device_Address, reg_Address, 1, &i2c_Data, 1, 200); in attempt to read from the OUT_X_L register, however the code is not yielding anything due to a lack of understanding on my behalf.Can anyone point me in the right direction to get readings from the registers using the I2C HAL library, or some useful information on using I2C?Thanks (Also my apologies for the appalling formatting, I am new to the forum and hope to learn a better method)
2016-04-11 10:02 AM
Hi barnsley.cinnibar,
You can refer to firmware of Batch aquisition Mode application note which is where there is R/W to and from LIS3DSH. -Hannibal-