02-25-2019 07:05 AM - edited 02-25-2019 07:07 AM
BMA423 step acquisition?
I followed the operation, but I can't get the reason for the interrupt from the interrupt, because it returns 0 every time, the direct reading step is also 0, other functions, such as writing the configuration file, getting the acceleration The values are all normal. Is it only normal to get the number of steps? Did I miss something?
static void Step_Interrupt(void) { motion_sensor_command_t command = PROCESS_STEP_INTERRUPT; xQueueSendFromISR(motionCommandQ, &command, &xHigherPriorityTaskWoken); } //The return value is normal, ignore the return value check here rslt |= bma423_init(&bmd4_dev); rslt |= bma423_write_config_file(&bmd4_dev); rslt |= bma423_step_counter_set_watermark(1, &bmd4_dev); rslt |= bma423_reset_step_counter(&bmd4_dev); rslt |= bma423_feature_enable(BMA423_STEP_CNTR, BMA4_ENABLE, &bmd4_dev); rslt |= bma423_step_detector_enable(BMA4_ENABLE, &bmd4_dev); rslt |= bma423_map_interrupt(BMA4_INTR1_MAP, BMA423_STEP_CNTR_INT, BMA4_ENABLE, &bmd4_dev); attachInterrupt(BMA423_INT1_PIN, Step_Interrupt, RISING); while(1){ rtosApiResult = xQueueReceive(motionCommandQ, &motionCommand, portMAX_DELAY); if (rtosApiResult == pdTRUE) { switch (motionCommand) { case PROCESS_STEP_INTERRUPT: bma423_read_int_status(&int_status, &bmd4_dev); if (int_status & BMA423_STEP_CNTR_INT) { bma423_step_counter_output(&stepCount, &bmd4_dev); printf("stepCount:%u\n",stepCount); } } }
02-27-2019 12:54 PM
In order to see interrupt signal from INT1 pin or INT2 pin, you need to configure register 0x53 or 0x54 to set the pin to be "Output enable" and "active high". In addition the step counter will show up when you do more than 7 steps. If you do 5 steps and stop for example, then the step counter will be 0. If you do 7 steps or more everytime, then the step couinter will show the correct value. This is the internal step counter buffer to avoid accident steps.
03-05-2019 11:48 AM
04-03-2019 09:01 AM
is this issue still there? Your description seems confusing, that you can get the step counter number during running, while you can only get 0 when you read the step counter number registers. please elaborate more here.
To understand clearly the sensor status and run further analysis, please read out the entire sensor register map when the issue happens:
0x00~0x25, 0x27~0x5D, 0x5F~0x7E
and read ~100bytes from 0x5E by a burst read.