Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMI085 FIFO interrupt not working as configured

    BMI085 FIFO interrupt not working as configured

    dcindric28
    Member

    Hello, 

    I'm developing an application which uses the BMI085 IMU sensor in the FIFO mode. Communication is done through SPI interface at 2 Mbit/s. Shuttle Board 2.0 with BMI085 IMU and STM32 Nucleo board is used for the evaluation. 

    I am able to perform initialization, load configuration file, and retrieve measurements from both accelerometer and gyroscope in polling mode without any problems.

    Problems arise when I try to use the IMU in the FIFO mode. I was able to retrieve data from the FIFO in polling mode, where data from the FIFO is read every 50 ms and then is FIFO emptied/reset. However, interrupt behavior is not as expected. 

    Figures in the attachment show the state of the 2nd interrupt channel (BMI08X_INT_CHANNEL_2) of the accelerometer in the FIFO mode. I presume interrupts are generated every time a new accelerometer measurement is written in the FIFO, and not on the FIFO full or when the data in the FIFO reaches the predefined watermark level. A similar issue with faulty interrupt behavior was reported here, although for a different IMU sensor: 

    https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BNO055-unstable-interrupt-pin-at-startup...

    The identical behavior can be observed for the gyroscope as well. 

     

    Here are the code snippets which are used for the FIFO interrupt configuration:

     

    //ACCELEROMETER FIFO CONFIGURATION SETUP
    	bmi08a_set_fifo_wm(BMI08X_ACCEL_FIFO_WATERMARK_LEVEL, &ConfigurationBosch);
    
    	imu_bosch_status = bmi08x_accel_fifo_interrupt_config (&ConfigurationBosch);
    
    	if (imu_bosch_status != BMI08X_INIT_SUCCESS)
    	{
    		//LOG_WriteToLog (Log_Error, "IMU Bosch accel FIFO config fail.");
    		return BMI08X_INIT_FAIL;
    	}
    
    	accel_fifo_cfg.accel_en = BMI08X_ENABLE;
    	accel_fifo_cfg.int1_en = BMI08X_ENABLE;
    	accel_fifo_cfg.int2_en = BMI08X_ENABLE;
    	accel_fifo_cfg.mode = BMI08X_ENABLE;
    
    
    	imu_bosch_status = bmi08a_set_fifo_config(&accel_fifo_cfg, &ConfigurationBosch);
    
    	if (imu_bosch_status != BMI08X_INIT_SUCCESS)
    	{
    		//LOG_WriteToLog (Log_Error, "IMU Bosch accel FIFO config fail.");
    		return BMI08X_INIT_FAIL;
    	}
    
    
    	//GYROSCOPE FIFO CONFIGURATION
    	imu_bosch_status = bmi08x_gyro_fifo_interrupt_config (&gyro_int_cfg, &ConfigurationBosch);
    
    	gyro_fifo_cfg.mode = BMI08X_GYRO_FIFO_MODE;
    	gyro_fifo_cfg.tag = BMI08X_GYRO_FIFO_TAG_DISABLED;
    
    	imu_bosch_status = bmi08g_set_fifo_config(&gyro_fifo_cfg, &ConfigurationBosch);

     

    where

    • ConfigurationBosch is bmi08x_dev struct
    • accel_fifo_cfg is bmi08x_accel_fifo_config struct
    • gyro_fifo_cfg is bmi08x_gyr_fifo_config

     and bmi08x_accel_fifo_interrupt_config and bmi08x_gyro_fifo_interrupt_config are wrapper function which perform the interrupt configuration:

     

    int8_t bmi08x_accel_fifo_interrupt_config (struct bmi08x_dev * bmi08x_dev)
    {
    
    	struct bmi08x_accel_int_channel_cfg accel_fifo_int = {0};
    
    	int8_t status;
    
    	accel_fifo_int.int_channel = BMI08X_INT_CHANNEL_2;
    	accel_fifo_int.int_type = BMI08X_ACCEL_INT_FIFO_WM;
    	accel_fifo_int.int_pin_cfg.output_mode = BMI08X_INT_MODE_PUSH_PULL;
    	accel_fifo_int.int_pin_cfg.lvl = BMI08X_INT_ACTIVE_HIGH;
    	accel_fifo_int.int_pin_cfg.enable_int_pin = BMI08X_ENABLE;
    
    	status = bmi08a_set_int_config(&accel_fifo_int, bmi08x_dev);
    
    	return status;
    }
    
    int8_t bmi08x_gyro_fifo_interrupt_config (struct bmi08x_gyro_int_channel_cfg * gyro_fifo_int, struct bmi08x_dev * bmi08x_dev)
    {
    	int8_t rslt;
    
    	gyro_fifo_int -> int_channel = BMI08X_INT_CHANNEL_3;
    	gyro_fifo_int -> int_type = BMI08X_GYRO_INT_FIFO_FULL;
    	gyro_fifo_int -> int_pin_cfg.output_mode = BMI08X_INT_MODE_PUSH_PULL;
    	gyro_fifo_int -> int_pin_cfg.lvl = BMI08X_INT_ACTIVE_HIGH;
    	gyro_fifo_int -> int_pin_cfg.enable_int_pin = BMI08X_ENABLE;
    
    	rslt = bmi08g_set_int_config ((const struct bmi08x_gyro_int_channel_cfg *) gyro_fifo_int, bmi08x_dev);
    
    	return rslt;
    }

     

     

    What can be the possible cause of this issue?  

    Best regards,

    Dino. 

    2 REPLIES 2

    BSTRobin
    Community Moderator
    Community Moderator

    Hi dcindric28,

    1.Compared your code and accel_fifo_watermark.c code on github https://github.com/BoschSensortec/BMI08x-Sensor-API/tree/master/examples/accel_fifo_watermark, your code didn't set water mark level, please refer acc FIFO example code on github.

    /* Set water mark level */
    rslt = bmi08a_set_fifo_wm(BMI08X_ACC_FIFO_WATERMARK_LEVEL, &bmi08xdev);
    bmi08x_error_codes_print_result("bmi08a_set_fifo_wm", rslt);

    /* Update FIFO structure */
    fifo_frame.data = fifo_data;
    fifo_frame.length = BMI08X_ACC_FIFO_RAW_DATA_USER_LENGTH;

    config.accel_en = BMI08X_ENABLE;

    /* Set FIFO configuration by enabling accelerometer */
    rslt = bmi08a_set_fifo_config(&config, &bmi08xdev);

    2.You also need to ensure your host has read the FIFO data completely after interrupt received.

    Hi, 

    Thank you for your response. As you can see in the code snippets I provided, I've already perfomed all of the steps you suggested and followed through the provided example for both accelerometer and gyroscope FIFO watermark application.

     

    The problem was not in the firmware, but in the hardware - combination of logic analyzer settings and wiring issues on the prototyping board/breadboard were problematic. Now it is working as expected. This topic can be closed.

     

    Best regards, 

    Dino. 

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist