bmi270
Bosch BMI270 — 6-axis IMU.
Layer 3: knows the part, not the chip driving it. It talks through a
[BusHandle] and has no idea whether an ESP32, an STM32 or a test mock is
underneath.
What this does
Section titled “What this does”Identifies the part and reads its status. It does not read motion yet: a BMI270 will not produce acceleration or rate until an 8 KiB configuration blob has been uploaded to it, which is a separate and much larger job than talking to the thing.
That is deliberate rather than unfinished. This driver exists to be the first device in this tree ever assembled through all three layers — Layer 1 registers, Layer 2 transport, Layer 3 device — and reading a chip ID over a real wire proves the whole path. Motion is a follow-up with its own issue.
Register facts
Section titled “Register facts”From Bosch’s own BMI270_SensorAPI, read rather than recalled:
BMI2_CHIP_ID_ADDR |
0x00 |
BMI270_CHIP_ID |
0x24 |
BMI2_I2C_PRIM_ADDR |
0x68 (SDO low) |
BMI2_I2C_SEC_ADDR |
0x69 (SDO high) |
Telling it apart from an MPU6886
Section titled “Telling it apart from an MPU6886”M5Stack shipped the ATOM Matrix with an MPU6886 and later revisions with a
BMI270. Both answer at 0x68, so the address identifies nothing — only
the ID register does, and the two put it in different places. probe
reads both and says which is actually on the board, rather than picking a
side and reporting a confusing failure when wrong.
Structs
Section titled “Structs”Bmi270
Section titled “Bmi270”struct Bmi270<'a> { /* private fields */ }A BMI270 on a bus.
Identity
Section titled “Identity”enum Identity { Bmi270, Mpu6886, Unknown(u8),}What answered at the address.
Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq
Constants
Section titled “Constants”ADDR_PRIMARY
Section titled “ADDR_PRIMARY”const ADDR_PRIMARY: u8;Primary address, SDO tied low. The ATOM Matrix wires it this way.
ADDR_SECONDARY
Section titled “ADDR_SECONDARY”const ADDR_SECONDARY: u8;Secondary address, SDO tied high.
CHIP_ID
Section titled “CHIP_ID”const CHIP_ID: u8;BMI270_CHIP_ID.
MPU6886_REG_WHO_AM_I
Section titled “MPU6886_REG_WHO_AM_I”const MPU6886_REG_WHO_AM_I: u8;An MPU6886’s WHO_AM_I register and its value.
Not this part, and deliberately here anyway: the two chips share an address
and a socket, so “which one is this” is a question this driver is the
natural place to answer. See probe.
MPU6886_WHO_AM_I
Section titled “MPU6886_WHO_AM_I”const MPU6886_WHO_AM_I: u8;MPU6886 WHO_AM_I value.
REG_CHIP_ID
Section titled “REG_CHIP_ID”const REG_CHIP_ID: u8;BMI2_CHIP_ID_ADDR.
REG_INTERNAL_STATUS
Section titled “REG_INTERNAL_STATUS”const REG_INTERNAL_STATUS: u8;INTERNAL_STATUS, which reports whether the config blob loaded.