Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI088 SPI read example for LINUX

    BMI088 SPI read example for LINUX

    yyjqr
    Member

    Recently, I try to read gyro chip id or acc chip id  from IMU BMI088 with SPI,  Linux and ARM  MCU (or liteos  CORTEX-M7).But I just get 0xFF,maybe my read function isn't right ....

     

    I can't find a good example code to read or write register  with SPI?  Does somebody have  written for Linux? Thanks in advance.

    The document said:

    The communication starts when the CSB (1 or 2) is pulled low by the SPI master and stops when CSB
    (1 or 2) is pulled high.SCK is also controlled by SPI master. SDI and SDO (1 or 2) are driven at the
    falling edge of SCK and should be captured at the rising edge of SCK.
    The data bits are used as follows:
    Bit #0: Read/Write bit. When 0, the data SDI is written into the chip. When 1, the data
    .
    SDO from the chip is read.
    Bit #1-7: Address AD(6:0).
    .
    Bit #8-15: when in write mode, these are the data SDI, which will be written into the
    .
    address.

    SO bit 0 is  write or read bit? and is it the LSB?  But my spi just has a SPI_LSB_FIRST MODE. 

    So  I change  the MASK as below, is it right??

    /**\name SPI read/write mask to configure address */
    #define BMI088_SPI_RD_MASK UINT8_C(0x01) //0x80--->0x01 BIT0 READ/WRITE TEST 1122 |
    #define BMI088_SPI_WR_MASK UINT8_C(0xFE) // 0x7F--->0xFE &

    2 REPLIES 2

    yyjqr
    Member

    NOW,We can get correct ACC chip id and gyro chip id.And the ACC data or gyro data.But when we try to get the ACC and GYRO data in successively, the ID read is right.But ACC values is not right!

     
     

    the ACC DATA and INT STATUS read is error as follows,

    IMU read 1209.png两个设备代码合并起来,读取 ,ACC INT 读到的是FF.PNG

    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