Bosch Sensortec Community

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

    BMM150 only reads once in forced mode

    jorgazam
    Established Member

    BMM150 only reads once in forced mode

    Hi,

    The problem I have now with the BMM150 is that when I set it to forced mode it only reads once, then stops reading the data. I do the configuration the same way that I can see in the GitHub example.

    settings.pwr_mode = BMM150_FORCED_MODE;
    rslt = bmm150_set_op_mode(&settings, dev);

    settings.preset_mode = BMM150_PRESETMODE_REGULAR;
    rslt = bmm150_set_presetmode(&settings, dev);

    I realized in the datasheet that every time the forced mode is done, the sensor goes to sleep, so I don't fully understand how this sensor works.  The sensor works in conjunction with another Bosch sensor, the BMI088, this other sensor is reading at 200 Hz. So I've tried to do the following.

    settings.pwr_mode = BMM150_POWERMODE_FORCED;
    rslt = bmm150_set_op_mode(&settings, &bmm150dev);
    rslt = bmm150_read_mag_data(&mag_data, &bmm150dev);

    Every time there is an interrupt for the BMI088 data ready, I reconfigure the forced mode of the BMM150 sensor then read the data. This way it always reads the data on every interrupt, but I think I'm not working properly with forced mode.

    Is there an example of how to work with forced mode? Also, Is there a way to read in forced mode without having to set the mode every time I'm going to read?

    Tags (3)
    2 REPLIES 2
    FAE_CA1
    Community Moderator

    Re: BMM150 only reads once in forced mode

    Hi,

    Thanks for your inquiry.

    After BMM150 is powered on, BMM150 will be in suspend mode. At this moment the only register you can read from and write to is register 0x4B. After you write value of 0x01 to register 0x4B, then BMM150 goes to sleep mode. At this moment you can read from and write to all registers such as the chip_ID register 0x40.

    From sleep mode you can configure BMM150 to work in normal mode (continuously update data registers up to 30Hz) or forced mode (also called single-shot or on-demand). This means that after you do,

            settings.pwr_mode = BMM150_POWERMODE_FORCED;
            rslt = bmm150_set_op_mode(&settings, &bmm150dev);

    BMM150 will start taking measurement. After the measurement is done and data registers are updated, BMM150 will go to sleep mode automatically waiting for the above command for next measurement. Therefore,  you need to repeat the above command every time to trigger the forced mode. If you use regular preset, then the max update rate is 100Hz in forced mode. If you choose low-power preset, then the max update rate can achieve 300Hz. The measurement time is defined in the formula on page 13 of BMM150 datasheet.

    Now you are using 200Hz BMI088 gyro data ready signal to get BMM150 data with code "rslt = bmm150_read_mag_data(&mag_data, &bmm150dev);". Usually magnetometer data doesn't need to be update at that fast at 200Hz for example. For eCompass or 9DoF sensor fusion, BMM150 update rate at 25Hz should be OK. That means that you can set BMM150 to be in normal mode at 25Hz ODR. So in the BMI088 gyro 200Hz interrupt routine, you can simply read BMM150 data and you don't need to use the above command for forced mode. However, you will get 8 times the same data from BMM150 because 25Hz * 8 = 200Hz.

    jorgazam
    Established Member

    Re: BMM150 only reads once in forced mode

    Apparently I've been working correctly with the forced mode, if it's as you've described. The problem I've had is that when I start to send the data captured by the sensors through BLE with the STM32WB5MMG, in the forced mode of the BMM150, the MCU arbitrarily disconnects from the mobile device.

    This seems to be partially solved if I work with the normal mode. Another thing that seemed to work with this MCU has been to  change the LSE drive setting from RCC_LSEDRIVE_LOW to RCC_LSEDRIVE_HIGH. However, I've been unable to solve why BLE disconnects when I'm working in forced mode.

    Anyway, thank you very much for your answer, it has been helpful.

    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