Skip to content

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.

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.

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)

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.

struct Bmi270<'a> { /* private fields */ }

A BMI270 on a bus.

enum Identity {
Bmi270,
Mpu6886,
Unknown(u8),
}

What answered at the address.

Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

const ADDR_PRIMARY: u8;

Primary address, SDO tied low. The ATOM Matrix wires it this way.

const ADDR_SECONDARY: u8;

Secondary address, SDO tied high.

const CHIP_ID: u8;

BMI270_CHIP_ID.

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.

const MPU6886_WHO_AM_I: u8;

MPU6886 WHO_AM_I value.

const REG_CHIP_ID: u8;

BMI2_CHIP_ID_ADDR.

const REG_INTERNAL_STATUS: u8;

INTERNAL_STATUS, which reports whether the config blob loaded.