LSM6DS3 PEDOMETER
Hi,
I'm trying to read step counts. I'm executing all pedometer related functions, but I get no any output.
Sincerely,
Talha
And While Loop
Hi,
I'm trying to read step counts. I'm executing all pedometer related functions, but I get no any output.
Sincerely,
Talha
And While Loop
Hi @Eleon BORLINI ,
I applied the configurations in the application note as mentioned. But the result is the same, negative.
static void pedoConf(void)
{
/* Holds reset variable. */
uint8_t rst = 0;
lsm6ds3_reset_set(&g_dev_ctx, PROPERTY_ENABLE);
do
{
lsm6ds3_reset_get(&g_dev_ctx, &rst);
}while(rst);
/* Enable Block Data Update */
lsm6ds3_block_data_update_set(&g_dev_ctx, PROPERTY_ENABLE);
lsm6ds3_int1_route_t int1_route_t;
/* Set Output Data Rate for Acc and Gyro */
lsm6ds3_xl_data_rate_set(&g_dev_ctx, LSM6DS3_XL_ODR_26Hz);
lsm6ds3_gy_data_rate_set(&g_dev_ctx, LSM6DS3_GY_ODR_26Hz);
lsm6ds3_xl_full_scale_set(&g_dev_ctx, LSM6DS3_2g);
lsm6ds3_gy_full_scale_set(&g_dev_ctx, LSM6DS3_2000dps);
/* Enable pedometer */
lsm6ds3_****_sens_set(&g_dev_ctx, 1);
lsm6ds3_pin_int1_route_get(&g_dev_ctx, &int1_route_t);
int1_route_t.int1_step_detector = PROPERTY_ENABLE;
lsm6ds3_pin_int1_route_set(&g_dev_ctx, &int1_route_t);
lsm6ds3_int_notification_set(&g_dev_ctx,LSM6DS3_INT_LATCHED);
/* Reset steps of pedometer */
lsm6ds3_****_step_reset_set(&g_dev_ctx, PROPERTY_ENABLE);
}I checked the lsm6d3_****_sens_set(), whether it is setting or not the related registers. All the registers we want, as mentioned in the application note, are setting with this function.
/**
* @brief Enable pedometer algorithm.[set]
*
* @param ctx read / write interface definitions(ptr)
* @param val change the values of ****_en in reg TAP_CFG
* @retval interface status (MANDATORY: return 0 -> no Error)
*
*/
int32_t lsm6ds3_****_sens_set(stmdev_ctx_t *ctx, uint8_t val)
{
lsm6ds3_ctrl10_c_t ctrl10_c;
lsm6ds3_tap_cfg_t tap_cfg;
int32_t ret;
ret = 0;
if (val == PROPERTY_ENABLE){
ret = lsm6ds3_read_reg(ctx, LSM6DS3_CTRL10_C, (uint8_t*)&ctrl10_c, 1);
if(ret == 0){
ctrl10_c.func_en = PROPERTY_ENABLE;
ret = lsm6ds3_write_reg(ctx, LSM6DS3_CTRL10_C, (uint8_t*)&ctrl10_c, 1);
}
}
if(ret == 0){
ret = lsm6ds3_read_reg(ctx, LSM6DS3_TAP_CFG, (uint8_t*)&tap_cfg, 1);
}
if(ret == 0){
ret = lsm6ds3_read_reg(ctx, LSM6DS3_TAP_CFG, (uint8_t*)&tap_cfg, 1);
}
if(ret == 0){
tap_cfg.****_en = (uint8_t)val;
ret = lsm6ds3_write_reg(ctx, LSM6DS3_TAP_CFG, (uint8_t*)&tap_cfg, 1);
}
return ret;
}I checked that and matched the other IMU's pedometer examples but it didn't work again.
if(all_source.func_src.step_detected)
{
/* Read steps */
lsm6ds3_number_of_steps_get(&g_dev_ctx, &steps);
UART_PRINT("Step: ");
UART_PRINT("%d\n", steps);
showError(ICON_HEART, NULL, steps, "Steps");
}In while loop, the way that I check if there is a detection or not. What can it possible error and how can I solve it?
Best regards,
Talha
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.