2021-03-03 02:15 AM
Hello, I'm using stm32 tilebox (STEVAL-MKSBOX1V1 )for vibration analysis. I need to change the smapling frecuency. Where is the parameter to change it? I'm using the BLEsensors application of FP-SNS-STBOX1.
Thanks
Solved! Go to Solution.
2021-03-04 03:19 AM
I found the parameter for changing the rate of the update of accelerometer value. On TargetFeatures.h, there are for parameters for enviromental features, inertial features, for blinking the led and for VCOM (i don't kown what is that). If you change the parameter STBOX1_UPDATE_INV, you change the frequency in which acc,gyro and magnometer features update its value.
Thanks anyway
2021-03-03 08:29 AM
Hi @Nicolás Martinez ,
The easiest way to configure of the SensorTile.Box sensors is to use the STBLE Sensor app, selecting a sensor and configuring its ODR as shown in the picture.
If however you are using the source code of the BLEsensors app you can change the ODR parameter from the file SensorTile.box_motion_sensors.c that you can find in the \Drivers\BSP\SensorTile.box folder, and particularly the function:
int32_t BSP_MOTION_SENSOR_SetOutputDataRate(uint32_t Instance, uint32_t Function, float Odr)
{
int32_t ret;
if (Instance >= MOTION_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if ((MotionCtx[Instance].Functions & Function) == Function)
{
if (MotionFuncDrv[Instance][FunctionIndex[Function]]->SetOutputDataRate(MotionCompObj[Instance], Odr) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
else
{
ret = BSP_ERROR_NONE;
}
}
else
{
ret = BSP_ERROR_WRONG_PARAM;
}
}
return ret;
}
Please let me know if you can target your purpose in this way and, if so, 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-03-03 09:41 AM
First of all thank you for your quick answer.
I tried to used that function changing the odr value several times, with different values, but when I read data, I got it every 0.05 seconds. Is there another parameter apart from odr? Maybe the sensors sampling frequency is being modify but not the frecuency data is updated.
I'm using a RPi 4 for the BLE connection. I modified the example_ble_1.py script from the STBlue sdk to read x,y ,z and timestamp. The output is the next:
Thanks
2021-03-04 03:19 AM
I found the parameter for changing the rate of the update of accelerometer value. On TargetFeatures.h, there are for parameters for enviromental features, inertial features, for blinking the led and for VCOM (i don't kown what is that). If you change the parameter STBOX1_UPDATE_INV, you change the frequency in which acc,gyro and magnometer features update its value.
Thanks anyway
2021-03-04 03:25 AM
Hi @Nicolás Martinez ,
ok now I better understand that you were looking for the frequency at which the data is made available on the interface, and not strictly the internal device ODR.
Glad you have found the solution :smiling_face_with_smiling_eyes:
-Eleon