Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Accessing BMM150 in BMX160 with Mbed running on STM32L476RG

    Accessing BMM150 in BMX160 with Mbed running on STM32L476RG

    swapnilsayan
    New Poster

    I have connected a BMX160 to an STM32 Nucleo board and have managed to obtain accelerometer and gyroscope readings via existing BMI160 Mbed library: https://os.mbed.com/teams/MaximIntegrated/code/BMI160/#4949e9b15b6e

    However, no such library exists for BMM150, so I was thinking of implementing my own using the sensor driver provided by Bosch (https://github.com/BoschSensortec/BMI160_driver) but I am having a bit of a difficulty understanding how to implement the user i2c read and write for my particular board in Mbed. I did find a platform-agnostic solution here, but it leaves out how to implement the I2c/Spi reads and writes: https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BMX160-magnetometer-problem/m-p/7692#M61...

    Any help would be appreciated.

     

    3 REPLIES 3

    fish
    Community Moderator
    Community Moderator

    Hi,

    Please refer to accessing-auxiliary-bmm150-with-bmm150-apis-via-bmi160-secondary-interface .

    In fact, BMX160 contain bmi160 and bmm150, bmm150 connected via bmi160 aux interface. So you could follow this workflow to get bmm150 data.

    Thanks. If you see my post I have already posted the same link. My problem is implementing the i2c reads and writes.

    fish
    Community Moderator
    Community Moderator

    Hi,

    Please remap read/write function in API to your platform. From bmi160.c, you could get read() format in bmi160_get_regs().

    Example in BMX160-magnetometer-problem :

        bmi.read = spi_read_transfer;
        bmi.write = spi_write_transfer;

    int8_t spi_read_transfer(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len);
    int8_t spi_write_transfer(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len);
     

    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