Thanks to the help of this forum and many hours, I was finally able to connect an Adafruit feather M0 with an LSM6DSOX chip to LINX.
The communication do work as I was able to make it blink !
However, I do have difficulties to read data from my LSM6DSOX accelerometer and this might in part be due to my lack of knowledge concerning the I2C write/read function.
Here is what I tried.
1. On page 57 of the LSM6DSOX datasheet, I have the register 01h to Enable embedded functions register (R/W). So I initially write 01h and then read the I2C expecting to see a value of 00000001, but, instead, got a value of 63 (decimals) on the second byte. What am I missing here ? How should I interpret my data ?
2. I also tried to get the temperature from my LSM6DOX.
For that, I know that OUT_TEMP_L (20h) and OUT_TEMP_H (21h) exist. As stated in the datasheet : "Temperature data output register (r). L and H registers together express a 16-bit word in two’s complement".
Thus, I tried to read that value this way, but only gets 0 values. What am I doing wrong here ?
Any thoughts ?
Thanks for you inputs !
Solved! Go to Solution.
Hey LonelyHunter, congrats so far on what you did! you are receiving one bit, and if one bit passes, bytes can pass too!
1) when you write 01h without anything else, you are just pointing to that register.
in sequence you are reading 8 registers starting on register 01h
0 on the first means that func_CFG_Acess is 0, SHUB_REG_ACCESS is 0 and OIS_CTRL_FROM_UI
63 on the second means that OCS and SDO AUX pins have pullup enabled and SCO_PU_EN have SCO pull up disconnected (the other 6 bits in "true" or "1" are default, thus 63 in decimal 00111111b = 63d)
then you can follow data sheet to interpret.
however if you want to write something to register 00h, you must include that data in your array.
see an example, these are just silly examples and not related to your application:
2) Probably some access or enable bit is not set, maybe it is not initialized, perhaps you shoud give some time to execute reading, i did not read all the datasheet, and dont have this sensor here to test
but if you want to read 2 bytes, you just need to use one read function, since one follow the other
first you point to 20h, then read 2 bytes. the way you did you are reading 20h to 27h then reading 21h to 28h
hope it helps you
in another time, i will try to look for some info to help you out.
Hey jorgemondadori !
Thanks for your answer. It was easy to follow and really helpful. Indeed, to activate the temperature sensor, I had to activate the accelerometer (which was not specified in the datasheet). Now I do understand how I2C works.
Thanks again ! Time to continu the work !