Bosch Sensortec Community

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

    BMX160 magnetometer trimming registers values

    BMX160 magnetometer trimming registers values

    flukettiscope
    Member

    Hi,

    I've noticed a weird problem in the compensated magnetometer data. The x ,y axes showed extremely low values(up to 0.03 gauss, and the earth's magnetic field was interpreted as 0.01, as if the scale is wrong), while the z axis seems okay(raw data for x and y axes was between -50 to 50).

    After searching the forum i came across the "bmm150-step-by-step-temperature-compensation-sample.pdf", and checked the sensor trimming data.

    Most of the values seemed okay except dig_xyz1(between 50000 and 60000), dig_xy1(around 250), which were about 10 times bigger than the values shown in the temperature-compensation-manual file.

    After looking at the BMM-Sensor-API, I've noticed that the mathematic operations in compenstaion_x and compensation_y functions with the trim parameters we received resulted in a value larger than the uint16 scale(data_rhall is about 6300).

    >>process_comp_x0 = data_rhall;

    >>process_comp_x1 = ((int32_t)dev->trim_data.dig_xyz1) * 16384;
    >>process_comp_x2 = ((uint16_t)(process_comp_x1 / process_comp_x0)) - ((uint16_t)0x4000);
    >>retval = ((int16_t)process_comp_x2);

    The results are:

    process_comp_x0 = 6300

    process_comp_x1 = 60000*16384 = 983x10^6

    process_comp_x2 = ((uint16_t)(983x10^6/ 6300)) - ((uint16_t)16384) = ((uint16_t)156038) - ((uint16_t)16384)  when 65535 is the maximum value for uint...

    afterwards I noticed in the driver that when it reads the dig_xyz register it excludes the MSB bit:

    >> temp_msb = ((uint16_t)(trim_xy1xy2[5] & 0x7F)) << 8;
    >>dev->trim_data.dig_xyz1 = (uint16_t)(temp_msb | trim_xy1xy2[4]);

    While the temperature compensation document doesn't mention it. Even with the trim corrent the values are still high and when casting the result of  process_comp_x2  to int16 in the following line it filps sign and becomes negative.

    The Issue appeared in 3 sensor out of 10.

    At this point I'm a bit confused and wanted to know if the trimming values we received are normal.

    In case they are not, can I calibration the value myself or should I disregard the temperature compensation?

    Best Regards,

    Jason

    6 REPLIES 6

    Hi,

    Solved!

    Apparently , every time the BMX160 tries to read BMM150 registers in setup mode, a multiple ms delay is required... after adding the delay the trim register values seemed fine.

    Thank you,

    Jason 

    Hi,

    Thanks for the update.

    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