Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMX160 Magnetometer problem.

    BMX160 Magnetometer problem.

    parkescape
    Member

    I'm using a BMX160 with an ARM Microprocessor, using I2C, code developed in C, using the MCUXpresso IDE to program the micro. I've got the accelerometer, gyro and magnetometer working as expected. The ARM board outputs a data stream to a tool on my pc that graphs the sensor values for all 9 axes. 

    When I program the board (through a USB connection) and run the software from my pc all is working correctly.

    When I disconnect the board from the usb connection, hard reset my electronics (power off power on, including the BMX160), the magnetometer does not provide any output data, but the accelerometer and gyro work as previously.

    I assumed it was a power-on start up race condition with the BMX160 and added delays of up to a second in the start up code before attempting to access any sensor registers, but this made no difference. I tried a softreset of the BMX160 (CMD register 0x7e set to 0xB2), a soft reset of the magnetometer, and a POR reset of the magnetometer, all with no success.

    Also checked that I'm not exceeding the power capabilites of the supply on my board.

    I think I'm missing something but can't find it.

    Any insight from anyone please?

    Thanks.

    7 REPLIES 7

    Minhwan
    Community Moderator
    Community Moderator

    Hello parkescape, 

     

    Here is the my example project based on Arduino. 

    What you have to do is to change i2c write read functions and delay function in your own.  

    (bmx160_hal_i2c_bus_read, bmx160_hal_i2c_bus_write bmx160_delay_usec functions. ) 

    Currently, my example is FIFO, but you can find other output method in github. 

    https://github.com/BoschSensortec/BMI160_driver

    I recommend github API, because BMX160 is actually BMI160 + BMM150 inside. 

    So, for magnetometer sensor BMM150, you need to configure inside interface  like this. 

    /* Auxiliary function definitions */
    int8_t bmm150_aux_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t length, void *intf_ptr)
    {
    return bmi160_aux_read(reg_addr, reg_data, length, &bmi160dev);
    }

    int8_t bmm150_aux_write(uint8_t reg_addr, uint8_t *reg_data, uint32_t length, void *intf_ptr)
    {
    return bmi160_aux_write(reg_addr, reg_data, length, &bmi160dev);
    }

    I don't think you did it. 

    Thanks, 

    Thanks - I got it fixed. Went back and reviewed all my set up values carefully and found a couple of errors. Corrected those and all now works.

    Weird symptom though - works when connected to the pc, but doesn't work after a reset when not connected to the pc.

    Thanks for your help.

    Andrew

    Minhwan
    Community Moderator
    Community Moderator

    Hello Andrew, 

     

    Good to hear that. 

    The weird symptom, I can check if you upload the logic analyzer log data. 

    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