2017-09-20 10:14 PM
Hi Guys, I'm planning on using the LSM9DS1 as a heading sensor on my board, and I was curious about the functionality of some of the pins - I couldn't find any detailed description in the datasheet.
The pin description describes Pins 5,6 (SDO_A/G, SDO_M) as 'I2C least significant bit of the device address' for I2C mode - are these required if talking to the module in I2C mode?
Also am I correct in assuming that pins 7,8 (CS_A/G, CS_M) just need to be pulled high externally to VDD_IO to enable I2C mode?
And are pins 9 - 13 required or is it possible to just use the I2C bus to talk to the module and read back measurements etc? I'm guessing the interrupts would be handy to alert to a fall or something like that but would not necessarily be required? And I'm not sure the purpose of the Data Ready, Data Enable Pins?
Many Thanks in advance!
Dave
#lsm9ds1Solved! Go to Solution.
2017-10-24 09:20 AM
Yes, in example two LSM9DS1 connected to the same I2C bus.
Only two 7-bit addresses are possible 1101010b = 0x6A or 1101011b = 0x6B, the last bit is set by the connection
SDO_A/G pin.
2017-10-24 09:45 AM
Thank you.
Will you be so kind as to answer another question ?
I have the address of I2C 0x6A. I want ot read WHO_AM_I (0x0F) and STATUS_REG(0x17)
Is it neccessary to set many control registers for accelerometer or only some of them ?
My try gives me only nulls in both of them.
2017-10-25 02:51 AM
You don't have to set any register to be able to read any sensor register.
Read
WHO_AM_I (0x0F) register is good start to check your sensor connection and I2C settings is correct.
If you read zeros then you have something wrong.
2017-10-25 04:53 AM
Thanks you very much.
Some questions more.
1.
Sub-address
Manual says:
In the I2C of the accelerometer and gyroscope sensor, after the start condition (ST) a slave address is sent, once a slave acknowledge (SAK) has been returned, an 8-bit sub-address (SUB) is transmitted.
8-bit sub-address (SUB) – register address ?
Slave address.
In table 15 in order to read one byte from sensor:
ST SAD+W SAK SUB SAK
I have SAD[6:1] = 0x6A
SAD+W – 7-bit slave address without SA0 ?
I.e., I have I2C address 110101 = 0x6A
7-bit SAD[6:1] + W = 110101 + 0 = 0x6A
Or
SA0 must be taken into account too and then, if SA0 = 0,
8-bit SAD[6:1] + SA0 + W = 110101 + 0 + 0 = 0xD4
2017-10-25 05:45 AM
Miroslav, thank you for your answers.
I‘ve succeeded to read the register WHO_AM_I. IMHO the description is not clear.
I write here code for c♯ and IoT.
I2cDevice
i2cDevAccel – c♯ object for communication channel I2C.
//I2C sensor address = 0x6A
//7-bit slave address SAD[6:1] + write -> 0x6A + 0 -> 0xD4
byte
[] buf1 =
new
byte
[] { 0xd4 };
//address of register WHO_AM_I = 0x0F
byte
[] buf2 =
new
byte
[] { WHO_AM_I };
//result of reading
byte
[] buf3 =
new
byte
[1];
i2cDevAccel.Write(buf1);
i2cDevAccel.WriteRead(buf2, buf3);
Result in buf3 must be equal to 0x68.
Once more thank you very much.