Important Cookie Information

This website uses absolutely necessary cookies. If you consent to the use of convenience cookies, please click “Yes, I agree.” By clicking on “Privacy Settings.” you can change this setting at any time and withdraw your given consent. Icon down see more You can find detailled information in our Privacy Policy Icon forward-right
Icon up see less

Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 NO MOTION Interrupt on INT2

    Member

    BMI270 NO MOTION Interrupt on INT2

    Hi,

    I'm trying to configure the NO MOTION Interrupt on BMI270 connected to an STM32F072 over SPI.
    The interrupt is never generated and I have verified it both using an oscilloscope and monitoring the INT_STATUS_0 register (bit num. 5).

    This is the code I use to initialize the sensor:

     

     

    int8_t BMI270_DEVICE_Init() {
    	systemStatus.bmi270_init_count++;
    
    	int8_t rslt = BMI2_OK;
    
    	struct bmi2_sens_config configs[SENS_COUNT];
    
    	// Array to select sensors
    	uint8_t sens_list[SENS_COUNT] = {
    			BMI2_ACCEL,
    			BMI2_GYRO,
    			// BMI2_TEMP, // Since Gyro is enabled, temperature is automatically enabled [see datasheet]
    			BMI2_NO_MOTION,
    			BMI2_AUX
    	};
    
    	// ----> Set SPI interface params
    	bmi270_dev.read = bm_spi_read;
    	bmi270_dev.write = bm_spi_write;
    	bmi270_dev.delay_us = delayUs;
    	bmi270_dev.read_write_len = SPI_MAX_RW;
    	bmi270_dev.intf = BMI2_SPI_INTERFACE;
    	bmi270_dev.dev_id = 0;
    	bmi270_dev.dummy_byte = 1;
    	bmi270_dev.config_file_ptr = NULL; // Load the default `bmi270_config_file` hard coded in the driver
    	// <---- Set SPI interface params
    
    	// ----> Chip-ID read to test SPI communication
    	uint8_t chip_id;
    	rslt = bmi2_get_regs(BMI2_CHIP_ID_ADDR, &chip_id, 1, &bmi270_dev);
    	if (rslt != BMI2_OK || chip_id != BMI270_CHIP_ID) {
    		rslt = BMI2_E_COM_FAIL;
    		goto exit;
    	}
    
    	HAL_Delay(10);
    	// <---- Chip-ID read to test SPI communication
    
    	// ----> Initialize bmi270
    	rslt = bmi270_init(&bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// <---- Initialize bmi270
    
    	// ----> Enable Sensors
    	//rslt = bmi2_sensor_enable(sens_list, SENS_COUNT, &bmi270_dev);
    	rslt = bmi2_sensor_enable(sens_list, 2, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    
    	// Accelerometer
    	configs[0].type = BMI2_ACCEL;
    	configs[0].cfg.acc.odr = BMI2_ACC_ODR_800HZ;
    	configs[0].cfg.acc.range = BMI2_ACC_RANGE_8G;
    	configs[0].cfg.acc.bwp = BMI2_ACC_OSR4_AVG1;
    	configs[0].cfg.acc.filter_perf = BMI2_PERF_OPT_MODE; // Filter for anti-aliasing
    
    	// Gyroscope
    	configs[1].type = BMI2_GYRO;
    	configs[1].cfg.gyr.odr  = BMI2_GYR_ODR_800HZ;
    	configs[1].cfg.gyr.range = BMI2_GYR_RANGE_1000 ;
    	configs[1].cfg.gyr.bwp =  BMI2_GYR_NORMAL_MODE;
    	configs[1].cfg.gyr.filter_perf = BMI2_PERF_OPT_MODE ; // Filter for anti-aliasing
    	configs[1].cfg.gyr.noise_perf = BMI2_PERF_OPT_MODE;
    
    	// No Motion detection
    	configs[2].type = BMI2_NO_MOTION;
    	configs[2].cfg.no_motion.select_x = BMI2_ENABLE;
    	configs[2].cfg.no_motion.select_y = BMI2_ENABLE;
    	configs[2].cfg.no_motion.select_z = BMI2_ENABLE;
    	configs[2].cfg.no_motion.out_conf = 0x06; // INT_STATUS_0 and INT2_MAP_FEAT  bit #5
    	configs[2].cfg.no_motion.duration = 5;
    	configs[2].cfg.no_motion.threshold = 144;
    
    	// Magnetometer
    	configs[3].type = BMI2_AUX;
    	configs[3].cfg.aux.aux_en = BMI2_ENABLE;
    	configs[3].cfg.aux.manual_en = BMI2_TRUE;
    	configs[3].cfg.aux.i2c_device_addr = 0x10; // I2C address of BMM150
    	configs[3].cfg.aux.read_addr = 0x40;	// Address of the first read address
    	configs[3].cfg.aux.man_rd_burst = 50;	// Total number of registers to be read for manual burst (0x40 to 0x71)
    	configs[3].cfg.aux.offset = 2;			// Offset for auto burst read
    	configs[3].cfg.aux.aux_rd_burst = 8;	// Size of auto burst read
    	configs[3].cfg.aux.fcu_write_en = BMI2_ENABLE;
    	configs[3].cfg.aux.odr = 1;
    
    	// Set the configurations
    	rslt = bmi2_set_sensor_config(configs, SENS_COUNT, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// <---- Enable Sensors
    
    	//
    	//	// TODO Configure BMM150 after BMI270 using bmi2_write_aux_man_mode
    	//
    
    	// ----> Interrupt PINs configuration
    	struct bmi2_int_pin_config int_pin_cfg;
    	int_pin_cfg.pin_type = BMI2_INT1;
    	int_pin_cfg.int_latch = BMI2_INT_NON_LATCH;
    
    	for(uint8_t i=0; i<BMI2_INT_PIN_MAX_NUM; i++ ) {
    		int_pin_cfg.pin_cfg[i].output_en = BMI2_INT_OUTPUT_ENABLE; 	// Output enabled
    		int_pin_cfg.pin_cfg[i].od = BMI2_INT_PUSH_PULL;				// OpenDrain disabled
    		int_pin_cfg.pin_cfg[i].lvl = BMI2_INT_ACTIVE_LOW;			// Signal Low Active
    		int_pin_cfg.pin_cfg[i].input_en = BMI2_INT_INPUT_DISABLE;	// Input Disabled
    	}
    
    	rslt =  bmi2_set_int_pin_config( &int_pin_cfg, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// <---- Interrupt PINs configuration
    
    	// ----> Map data interrupt
    	rslt = bmi2_map_data_int( BMI2_DRDY_INT, BMI2_INT1, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// <---- Map data interrupt
    
    	// ----> Map features interrupts
    	struct bmi2_sens_int_config feat_int;
    	feat_int.type = BMI2_NO_MOTION;
    	feat_int.hw_int_pin = BMI2_INT2;
    
    	rslt = bmi2_map_feat_int(&feat_int, 1, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// <---- Map features interrupts
    
    	exit:
    	if( rslt == BMI2_OK ) {
    		systemStatus.bmi270_initialized = 1;
    	} else {
    		systemStatus.bmi270_initialized = 0;
    	}
    	return rslt;
    }</bmi2_int_pin_max_num;>

     

     

    Any advice?

    Thank you
    Walter

    1 REPLY 1
    Highlighted
    Member

    Re: BMI270 NO MOTION Interrupt on INT2

    I tested many configurations, but I continue to not being able to get the NO_MOTION interrupt working.
    I also moved the DATA_READY interrupt to INT2 to verify that it is correctly configured and it's ok, so it's a configuration problem that I cannot figure out.

    Any advise?

    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