2019-05-06 03:26 AM
Hello,
I'm actually work with sensorTile for vibration analysis. I'm using defaut demo library ALLMEMS1 V340 and communicate by Bluetooth. My first data collection are very well but now i want to change my sampling periode from 52Hz (defaut Acc sampling time 50ms) to higher.
I know possibilities of the sensor and found the table, but i dont found the setting value for change it. I turn around for couple of hour...
I use AC6 to read library, and programming sensor with an nucleo board L476RG and STM32 cube.
Thanks for you help
2019-05-07 05:29 AM
Hi David, to change the LMSD6 sampling rate (ODR) you could directly define the ODR mask in the LSM6DSM_ACC_GYRO_driver.h file as shown here below, and then download your FW on the Sensortile MCU. If you are using also the android smartphone apk please check if it is still working after the change. Regards
/*******************************************************************************
* Register : CTRL1_XL
* Address : 0X10
* Bit Group Name: ODR_XL
* Permission : RW
*******************************************************************************/
typedef enum
{
LSM6DSM_ACC_GYRO_ODR_XL_POWER_DOWN = 0x00,
LSM6DSM_ACC_GYRO_ODR_XL_13Hz = 0x10,
LSM6DSM_ACC_GYRO_ODR_XL_26Hz = 0x20,
LSM6DSM_ACC_GYRO_ODR_XL_52Hz = 0x30,
LSM6DSM_ACC_GYRO_ODR_XL_104Hz = 0x40,
LSM6DSM_ACC_GYRO_ODR_XL_208Hz = 0x50,
LSM6DSM_ACC_GYRO_ODR_XL_416Hz = 0x60,
LSM6DSM_ACC_GYRO_ODR_XL_833Hz = 0x70,
LSM6DSM_ACC_GYRO_ODR_XL_1660Hz = 0x80,
LSM6DSM_ACC_GYRO_ODR_XL_3330Hz = 0x90,
LSM6DSM_ACC_GYRO_ODR_XL_6660Hz = 0xA0,
} LSM6DSM_ACC_GYRO_ODR_XL_t;
#define LSM6DSM_ACC_GYRO_ODR_XL_MASK 0xF0
status_t LSM6DSM_ACC_GYRO_W_ODR_XL(void *handle, LSM6DSM_ACC_GYRO_ODR_XL_t newValue);
status_t LSM6DSM_ACC_GYRO_R_ODR_XL(void *handle, LSM6DSM_ACC_GYRO_ODR_XL_t *value);
status_t LSM6DSM_ACC_GYRO_translate_ODR_XL(LSM6DSM_ACC_GYRO_ODR_XL_t value, u16_t *odr_hz_val);
2019-05-07 06:46 AM
Hi Eleon
Thanks for you help. So because i m very new in programming, please could you precise what i need to change.
Do you mean change directly the mask value by 0x40 for 100Hz by example?
I try to do it but I haven't see change on timestamp in my cvs report (by unicleo Gui) i have always 50ms sampling time. mayby i need to change an other paramater ?
Thanks
2019-05-07 09:20 AM
Eleon,
After trying to understand the architecture, i realized that the ACC ODR is maybe well set and i juste need to change the timestamp data for data at 10ms Frequency. Actually it work aroud 1 data each 50ms. I have trying to do this with algobuilder and it work fine. In my csv file a have 10ms timestamp
but now i want to do it with Bluetooth Project ALLMEMS1, but dont found the data to modify....
I hope to be clear in my explaination
Thanks
2019-05-07 09:23 AM
Eleon,
After trying to understand the architecture, i realized that the ACC ODR is maybe well set and i juste need to change the timestamp data for data at 10ms Frequency. Actually it work aroud 1 data each 50ms. I have trying to do this with algobuilder and it work fine. In my csv file a have 10ms timestamp
but now i want to do it with Bluetooth Project ALLMEMS1, but dont found the data to modify....
I hope to be clear in my explaination
Thanks
2019-05-10 04:01 AM
Hi David, the previous code is the low level function related to the LSM6DS3M, while the high level function you should call is inside User -> TargetPlatform.c and refers to SensorTile_accelero.c. If you call this in the user code
/**
* @brief Set the accelerometer sensor output data rate
* @param handle the device handle
* @param odr the functional output data rate to be set
* @retval COMPONENT_OK in case of success
* @retval COMPONENT_ERROR in case of failure
*/
DrvStatusTypeDef BSP_ACCELERO_Set_ODR( void *handle, SensorOdr_t odr )
{
DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
ACCELERO_Drv_t *driver = NULL;
if(ctx == NULL)
{
return COMPONENT_ERROR;
}
driver = ( ACCELERO_Drv_t * )ctx->pVTable;
if ( driver->Set_ODR == NULL )
{
return COMPONENT_ERROR;
}
if ( driver->Set_ODR( ctx, odr ) == COMPONENT_ERROR )
{
return COMPONENT_ERROR;
}
return COMPONENT_OK;
}
basing on these definition in sensor.h
typedef enum
{
ODR_LOW,
ODR_MID_LOW,
ODR_MID,
ODR_MID_HIGH,
ODR_HIGH
} SensorOdr_t;
Consider that the default ODR data is in 104Hz as you can check in LSM6DSM_ACC_GYRO_driver_HL.c
/* Select default output data rate. */
pComponentData->Previous_ODR = 104.0f;
2019-05-13 09:47 AM
Hello Eleon, thank you for your help
I found all the data your show in your answer, and this remains a mystery to me because, since the ODR is actually well set to 100.4f, my samling data still represents 50ms sampling period.
I collect data with Android APP and Unicleo and it's the same sampling period !!!
I have taken a screenshot of my CSV values , I will be very grateful to lighting me. Thanks a new time for your help