Bosch Sensortec Community

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

    BMM150 not updating in forced mode

    BMM150 not updating in forced mode

    Myzhar
    Established Member

    Hi all,
    I'm trying to get BMM150 magnetometer data @100Hz using the BMI270 as master device, but when I configure the sensor in forced mode I only get the first measure, the next measures are all equals.

    This is my configuration code for BMM150:

    int8_t BMM150_DEVICE_Init() {
    	int8_t rslt = BMM150_OK;
    
    	// ----> BMM150 initialization over I2C (BMI270 aux)
    	bmm150_dev.dev_id = BMM150_DEFAULT_I2C_ADDRESS;
    	bmm150_dev.intf = BMM150_I2C_INTF;
    	bmm150_dev.read = bmm150_read;
    	bmm150_dev.write = bmm150_write;
    	bmm150_dev.delay_ms = bmm150_delay_ms;
    
    	rslt = bmm150_init(&bmm150_dev);
    	if(rslt!=BMM150_OK) {
    		goto exit;
    	}
    	// <---- BMM150 initialization over I2C (BMI270 aux)
    
    	//perform_self_tests(&bmm150_dev);
    
    	// ----> Configuration
    	bmm150_dev.settings.preset_mode = BMM150_PRESETMODE_REGULAR;
    	rslt = bmm150_set_presetmode(&bmm150_dev);
    	if(rslt!=BMM150_OK) {
    		goto exit;
    	}
    
    	bmm150_dev.settings.pwr_mode = BMM150_FORCED_MODE;
    	rslt = bmm150_set_op_mode(&bmm150_dev);
    	// <---- Configuration
    
    	exit:
    	if( rslt == BMM150_OK ) {
    		systemStatus.bmm150_initialized = 1;
    	} else {
    		systemStatus.bmm150_initialized = 0;
    	}
    	return rslt;
    }
    
    void bmm150_delay_ms(uint32_t msec) {
    	HAL_Delay(msec);
    }
    
    int8_t bmm150_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *read_data, uint16_t len) {
    	return bmi2_read_aux_man_mode(reg_addr, read_data, len, &bmi270_dev);
    }
    
    int8_t bmm150_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *write_data, uint16_t len) {
    	return bmi2_write_aux_man_mode(reg_addr, write_data, len, &bmi270_dev);
    }

     

    Is there something to be changed to get it working correctly?

    Thank you,
    Walter

    2 REPLIES 2

    Myzhar
    Established Member

    I finally found the solution to the problem: the BMM150 was correctly configured, but the BMI270 was not.
    It is very important to set
    config.cfg.aux.fcu_write_en = BMI2_ENABLE;
    in the configuration of the auxiliar sensor, this option is really badly documented (no cited in BMM150 datasheet, no explained in BMI270 datasheet):

     

    	// ----> Initialize BMM150
    	struct bmi2_sens_config config;
    
    	// Magnetometer in manual mode for configuration
    	config.type = BMI2_AUX;
    	config.cfg.aux.aux_en = BMI2_ENABLE;
    	config.cfg.aux.manual_en = BMI2_TRUE;
    	config.cfg.aux.i2c_device_addr = BMM150_DEFAULT_I2C_ADDRESS; // I2C address of BMM150
    	config.cfg.aux.read_addr = BMM150_CHIP_ID_ADDR;	// Address of the first read address
    	config.cfg.aux.man_rd_burst = BMI2_AUX_READ_LEN_0;	// Size of manual burst read
    
    	// Set the configurations
    	rslt = bmi2_set_sensor_config(&config, 1, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    
    	rslt = BMM150_DEVICE_Init();
    	if (rslt != 0)
    		goto exit;
    
    	// Automatic burst read
    	config.type = BMI2_AUX;
    	config.cfg.aux.aux_en = BMI2_ENABLE;
    	config.cfg.aux.manual_en = BMI2_FALSE;
    	config.cfg.aux.i2c_device_addr = BMM150_DEFAULT_I2C_ADDRESS; // I2C address of BMM150
    	config.cfg.aux.read_addr = BMM150_DATA_X_LSB;	// Address of the first read address
    	config.cfg.aux.offset = 0;
    	config.cfg.aux.aux_rd_burst = BMI2_AUX_READ_LEN_3;	// Size of auto burst read
    	config.cfg.aux.fcu_write_en = BMI2_ENABLE;
    	config.cfg.aux.odr = BMI2_AUX_ODR_100HZ;
    
            // Set the configurations
    	rslt = bmi2_set_sensor_config(&config, 1, &bmi270_dev);
    	if (rslt != BMI2_OK)
    		goto exit;
    	// <---- Initialize BMM150

     


    I suggest to add a configuration example for BMM150 in the BMI270 README.

    Walter 

    vamshi
    Established Member

    Hi @Myzhar ,

    I too got the same problem. Still I'm trying in Arduino with ESP32-C3 Module, can you please share me the code which you are using for Acc, Gyro, Mag data of BMI270 shuttle board. I'm trying to resolve this problem so many days but no use.

    Any help would be very thankful.

    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