Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMM150 Forced Mode Configuration

    BMM150 Forced Mode Configuration

    DPatrick
    New Poster
    Hi,
    I'm using the BMM150 magnetometer and I'm trying to read at 100Hz in Forced mode but it only seems to be reading at 18Hz.
    I've been able to set the output data rate in normal mode and achieved the behaviour you'd expect, however Forced mode is proving more difficult.
     
    I've set it in forced mode, I've selected minimal repetitions on all axes, and I'm sending read requests at 100Hz but it's still only resulting in 18Hz.
     
    So for clarity, to register 0x4C I am writing 00000010b to set:
    • Advanced self-test off
    • Output DataRate to default
    • Operation mode to Forced
    • Self test to off
    Also, to register 0x51 and 0x52 I've written 00000001b and 00000010b respectively to set:
    • 3 repetitions on XY axes
    • 3 repetitions on Z axis
    Any help would be greatly appreciated!
    Kind Regards,
    David
     
     
    3 REPLIES 3

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi David,

    Thanks for your inquiry.

    After BMM150 is powered on, it will stay in Suspend mode doing nothing. In your initialization function you can write value of 0x01 to register 0x4B to bring BMM150 to Sleep mode. Then you can configure register 0x51 and 0x52 to make nXY = 3 and nZ = 3. In your 100Hz timer interrupt routine you can write value of 0x02 to register 0x4C to trigger Forced mode. According to the formula on page 13 of BMM150 datasheet, BMM150 will take about 2.9ms to finish the measurement and then BMM150 will go to Sleep mode automatically waiting for the next trigger by writing value of 0x02 to register 0x4C again. Then you should be able to get BMM150 data at 100Hz sampling rate in Forced mode.

    Here is the pseudo code:

    BMM150_init()

    {  Write value of 0x01 to register 0x4B;  // bring BMM150 to Suspend mode

        Write value of 0x01 to register 0x51;  // set nXY = 3

        Write value of 0x02 to register 0x52;  // set nZ = 3

    }

    Timer_interrupt_10ms()

    {  Write value of 0x02 to register 0x4C;  // trigger Forced mode

        Delay(5ms);  // wait for BMM150 to finish the measurements

        Get BMM150 x/y/z compensated values in the unit of uT;  // call API function at https://github.com/boschsensortec/BMM150-Sensor-API

        Print out the values;  // on PC terminal through serial port

    }

    Thanks.

    Hi, thanks for your help!

    So I've been trying to modify the driver in this opensource flight controller firmware (PX4, linked below)  by implementing your advice, however I've not managed to get it to work yet.
    https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/magnetometer/bosch/bmm150

    I've tried setting Forced mode with a 5ms delay on every read cycle, set the XY and Z repetitions accordingly in the configuration etc but still no luck, it seems to stay ~17Hz.

    I know it's asking a bit much, but would you be able to take a look at the driver and linked above and see if you can spot any obvious parts that would conflict with Forced mode? It really would help massively. (The link above is without any of my modifications)

    Kind Regards,
    David

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Sorry that we cannot check third party code for our sensors because we have our own API code available on the Github.

    Now you can try to use BMM150 normal mode to see if you can get correct data by following the example at https://github.com/boschsensortec/BMM150-Sensor-API/blob/master/examples/generic/mag_drdy_interrupt/.... If it works, then you can follow my above pseudo code for forced mode so that you can have much faster sampling rate from BMM150.

    Thanks.

    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