Hello chuannes,
Error code -9 means loading config failed, you could see it from BMI270 driver code. #define BMI2_E_CONFIG_LOAD INT8_C(-9)
As you loaded config failed, you should check your read, write, delay funtion and your SPI hardware configuration. By the way, BMI270 SPI interface is incompatible with two mode: '00'[CPOL=0, CPHA=0], '11'[CPOL=1, CPHA=1]. When you initialized your PIC32 SPI interface, you need to choose one mode of 00 or 11.
The default SPI read and write length is 32 byte, this length depends on the read and write length supported by the host SPI. You could modify it according to the actual host SPI maxmum length. #define READ_WRITE_LEN UINT8_C(32)
... View more