2021-04-06 01:46 PM
LSM6DSO Application Note, page 67: The value is expressed as a 16-bit word in two’s complement.
Question: is this a SIGNED or UNSIGNED value?
Solved! Go to Solution.
2021-04-07 12:20 AM
Hi @BDiva.1 ,
since it is reported in two's complement, it is a signed value (the physical principle interpretation is that acceleration can be negative if it is in the opposite verse -for example- of the earth gravity). You can check the direction of the acceleration / angular speed from the picture in the datasheet p.6:
LSB-to-physical units conversion formula (for the accelerometer) is the following one (lsm6dso_reg.c:(
float_t lsm6dso_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
}
If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.
-Eleon
2021-04-07 12:20 AM
Hi @BDiva.1 ,
since it is reported in two's complement, it is a signed value (the physical principle interpretation is that acceleration can be negative if it is in the opposite verse -for example- of the earth gravity). You can check the direction of the acceleration / angular speed from the picture in the datasheet p.6:
LSB-to-physical units conversion formula (for the accelerometer) is the following one (lsm6dso_reg.c:(
float_t lsm6dso_from_fs2_to_mg(int16_t lsb)
{
return ((float_t)lsb) * 0.061f;
}
If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.
-Eleon
2021-04-07 07:51 AM
Eleon,
2021-04-14 03:44 AM
Hi @BDiva.1 ,
in 1., you are speaking of "compressed data"... are you referring to the FIFO operation? Probably I'm not understanding which part of which application note are you referring to... can you please detail a bit more the reference?
Note that in general all the thresholds and counter values are unsigned (integers), while the data output are signed floating...
Regarding your question 2., the int16_t indicates a 16-bit words, that includes the concatenation of the MSB with the LSB. So you are right, each XL value contains both 8-bit data content. After the concatenation, you have to convert the 16-bit hexadecimal value into decimal via two's complement conversion.
-Eleon
2021-04-14 06:24 AM
Yes, for the FIFO data the spec explicitly states the data is signed since they are encoded with two's complement; but for the OUTX_L_A (28h) and OUTX_H_A (29h) for example are not explicitly state that they are signed two's complement values. see p.67 of LSM3DSO Datasheet (not App.Note as I mistakenly referenced in the original post.
2021-04-15 02:45 AM
Hi @BDiva.1 ,
they are too.
If this can cause misunderstandings, I'll submit the point internally to the attention of our online documentation editors.
-Eleon
2021-04-16 08:07 AM
Thanks Eleon!