05-05-2022 01:44 PM
I am using the code below to generate fifo watermark interrupts but I don't see any watermark interrupts generated. What am I doing wrong?
(Sorry for the bad make up but I dont see an option to add a code )
int8_t Open_BMI160_FIFO(struct bmi160_dev *dev)
{
int8_t rslt = BMI160_OK;
struct bmi160_int_settg int_config;
fifo_frame.data = fifo_buff;
fifo_frame.length = 1024;
dev->fifo = &fifo_frame;
/* Clear FIFO configuration register */
rslt = bmi160_set_fifo_config(BMI160_FIFO_CONFIG_1_MASK, BMI160_DISABLE, dev);
if (rslt != BMI160_OK)
{
PDEBUG("Clear FIFO configuration register error, error code: %d\r\n", rslt);
return rslt;
}
rslt = bmi160_set_fifo_wm(43, dev);//7*50=350 bytes, water mark value was word unit, cann't be greater than 255, 87*4=348
if(rslt != BMI160_OK)
{
PDEBUG("bmi160_set_fifo_wm error, error code: %d\r\n", rslt);
}
// BMI160_FIFO_A_ENABLE enable fifo for accelerometer only
rslt = bmi160_set_fifo_config(/*BMI160_FIFO_A_ENABLE |BMI160_FIFO_TAG_INT1 */
BMI160_FIFO_ACCEL|BMI160_FIFO_HEADER, BMI160_ENABLE, dev);
if(rslt != BMI160_OK)
{
PDEBUG("bmi160_set_fifo_config error, error code: %d\r\n", rslt);
}
/* Flush FIFO */
rslt = bmi160_set_fifo_flush(dev);
if (rslt != BMI160_OK)
{
PDEBUG("Flush FIFO error, error code: %d\r\n", rslt);
return rslt;
}
/* Select the Interrupt channel/pin */
int_config.int_channel = BMI160_INT_CHANNEL_1;// Interrupt channel/pin 2
/* Select the Interrupt type */
int_config.int_type = BMI160_ACC_GYRO_FIFO_WATERMARK_INT;// Choosing interrupt
/* Select the interrupt channel/pin settings */
int_config.int_pin_settg.output_en = BMI160_ENABLE;// Enabling interrupt pins to act as output pin
int_config.int_pin_settg.output_mode = BMI160_DISABLE;// Choosing push-pull mode for interrupt pin
int_config.int_pin_settg.output_type = BMI160_DISABLE;// Choosing active high output
int_config.int_pin_settg.edge_ctrl = BMI160_DISABLE;// Choosing edge triggered output
int_config.int_pin_settg.input_en = BMI160_DISABLE;// Disabling interrupt pin to act as input
int_config.fifo_wtm_int_en = BMI160_ENABLE;//Enable FIFO watermark interrupt
/* Set the FIFO watermark interrupt */
bmi160_set_int_config(&int_config, dev);
return rslt;
}
Solved! Go to Solution.
05-05-2022 04:09 PM
Hi André,
1.What is ODR you used?
2.How long do you want to get watermark interrupt?
3.Has the interrupt pin on the host side was connected to INT1 and been initialized?
05-12-2022 02:52 PM
I fixed it, cause was a to low watermark at an ODR of 1600Hz. 😕