Bosch Sensortec Community

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

    BMM150 threshold limit value

    BMM150 threshold limit value

    jorgazam
    Established Member

    https://github.com/BoschSensortec/BMM150-Sensor-API/blob/master/examples/generic/low_threshold/low_t... 

    The low threshold example uses a 0x0A value, which corresponds to 10 in decimal, so 10*6 = 60 uT is the low threshold limit the example have set, but it doesn't specify whether it's a positive or a negative limit, or for which axis the limit is.

    /*! low threshold limit */
    uint8_t low_threshold;

    /*! high threshold limit */
    uint8_t high_threshold;

    Also, both low and high threshold limit are uint8_t, so I would like to know if it's possible to use a negative limit in order to get a interrupt, since both the raw and compensated micro tesla values of the magnetometer are sometimes negative.

    9 REPLIES 9

    BSTRobin
    Community Moderator
    Community Moderator

    Hello jorgazam,

    Could we know the specific phenomenon that the example on GitHub can't work?

    jorgazam
    Established Member

    I've attached the STM32 project with the high threshold example. I made that it reads only when there is an interrupt.

    As you can see in the GIF that I have attached as well, the interrupt happens all the time, the status never seems to change even if I move all the axes to check where the interrupt is, since in the example it does not specify which axis is used. The limit is set to 0x12.

     

     

     

    BSTRobin
    Community Moderator
    Community Moderator

    Hello jorgazam,

    Sorry for the delay reply.
    Your code will do self test every time when it is powered on. Can you change it to the following code logic and test it again?

    rslt = bmm150_interface_selection(&bmm150dev);
    rslt = init_bmm150(&bmm150dev);

    while (1)
    {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
    rslt = bmm150_get_interrupt_status(&bmm150dev);
    if (bmm150dev.int_status & BMM150_INT_ASSERTED_HIGH_THRES)
    {
    rslt = bmm150_read_mag_data(&mag_data, &bmm150dev);
    compass = atan2(mag_data.y, mag_data.x) * 180 / M_PI;
    }

    HAL_Delay(100);
    }

    jorgazam
    Established Member

    Hi BSTRobin,

    The behavior doesn't seem to change with this change, in any case, the boot only performs it once at the beginning of the main, in what way is it possible that the selftest causes this failure, is it necessary to return to a "normal" state after doing the selftest ?

    BSTRobin
    Community Moderator
    Community Moderator

    Hello jorgazam,

    Sorry for the delay reply.
    After our check, there was a mistake in BMM150 sensor API. The definition of BMM150_INT_ASSERTED_HIGH_THRES in bmm150_defs.h API should be equal to 0x0038 rather than 0x0380.

    We will update BMM150 sensor API.

    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