BMI088 SPI read example for LINUX

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