07-12-2023 04:30 AM
hi, all
I use SPI to connect to BMI270, I have 2 questions:
1. when I send 0x80 0xff 0xff, I can read MISO as 0xff 0x00 0x24. So 0x24 is chip_id, it is correct.
when I send 0x80 0xff, I can read MISO as 0xff 0x00.
which command is correct?
2. when I read BMI270 status after write_config_file, which command should I use?
send 0xa1 0xff 0xff and read receive buffer of 3 bytes, byte0: ff, byte 1: ff and byte 2 is the status
or send 0xa1 0xff and read receive buffer of 2bytes, byte 0: ff, byte 1: the status.
which is correct?
Thank you in advance.
Solved! Go to Solution.
07-12-2023 09:42 AM
Hi victorheca01,
Please note that the first byte received from the device via the SDO line corresponds to a dummy byte and the second byte corresponds to the value read out of the specified register address.
I also upload actual SPI waveform on MCU platform for your reference.
Do you mean reading BMI270 internal status after loading config file? If yes, the register address should be 0x21.
There is BMI270 sensor API & example code for your reference on github https://github.com/boschsensortec/BMI270-Sensor-API.It has implemented the driver code for accessing sensor.
07-12-2023 08:45 PM
Thank you very much. I understood it. Now I found that software has the following problem:
In write_config_file(), after
rslt = bmi2_set_adv_power_save(BMI2_DISABLE, dev);
I read chip_id and found that dummy_read = 0xff;
rslt = bmi2_get_regs(BMI2_CHIP_ID_ADDR, &dummy_read, 1, dev);
also after rslt = bmi2_set_regs(BMI2_CMD_REG_ADDR, &data, 1, dev);
when run rslt = bmi2_get_regs(BMI2_CHIP_ID_ADDR, &dummy_read, 1, dev); I got dummy_read = 0xff;
looks like when I send any command to BMI270, will get chip_id=0xff. However, at beginning of software to read chip_id, it successfuly return 0x24. What is the problem? Thanks in advance.
07-12-2023 11:11 PM
this is the waveform of MOSI when I send bmi2_set_regs(BMI2_CMD_REG_ADDR, &data, 1, dev); 0x7F 0xB6. Thanks