cancel
Showing results for 
Search instead for 
Did you mean: 

Changing scale of accelerometer (+-2g to +-8g) in Sensortile

AS??l.0
Associate

Hello,

i want to change the scale of Accelerometer LSM6DSM from default +-2g to +-8g in the Sensortile. If i use the Firmware "FP-SNS-allmems1" and call the function "DrvStatusTypeDef BSP_ACCELERO_Set_FS_Value ( void * handle,  float fullScale) " with BSP_ACCELERO_Set_FS_Value(TargetBoardFeatures.HandleAccSensor,4.0f) i don't get any change of scale, so if i log Data trough the App "ST BlueMS" i don't get Values above +-2g.

Pls help.

3 REPLIES 3
SKada.2086
Associate II

Even I am facing same problem . If you changed successfully, can you suggest me ?

ÉCast.1
Associate

Hello,

I am also facing the same issue. The LSM6DSM from the Sensortile seems to be configured by default to +/- 2g fullscale. I want to change the ST code to use +/- 8g and it does not seem that the ST code taken directly from the ST website is working for this case.

Several return values are not checked while the sensors are started/configured; many functions are returning unchecked and unhandled errors.

Changing the LSM6DSM_ACC_FS define to "8" instead of "2" does not change the range as expected.

Is there anyone at ST that tried to use their own code with 8g configuration?

Thank you for your help.

Best regards

ÉCast.1
Associate

So , I figured out how to modify the acceleration data full range from the ST example downloaded from their website.

Here are the steps I followed to change from 2g/50Hz to 8g/100Hz :

  • Download the STSW-STLKT01 package on the ST website (https://www.st.com/en/evaluation-tools/steval-stlkt01v1.html#tools-software)
  • Unpack, open and compile the project (Projects/SensorTile/Applications/DataLog)
  • Comment the SAMPLING_50Hz define and uncomment the SAMPLING_100Hz define
  • Change the value of the LSM6DSM_ACC_FS define from 2 (+/-2g range) to 8 (+/-8g range)
  • In the main.c file, in the GetData_Thread thread, add a call to the function BSP_MOTION_SENSOR_SetFullScale() after initialization and before the main for(;;) loop. The call look like this:  BSP_MOTION_SENSOR_SetFullScale(LSM6DSM_0, MOTION_ACCELERO, LSM6DSM_ACC_FS); This is necessary because the first call from ST does not work. I'm not sure why this works but well, I don't have time to repair this whole vendor code.
  • That's it!

The original ST code is nonetheless broken; several init functions are not checked for errors and do not run as expected (many errors).

Hope it will help you one day!

https://xkcd.com/979