IMU & Motion

STMicroelectronics LIS2MDL in the datasheet corpus

3-axis ±50 gauss digital magnetometer with hard-iron offset registers and temperature sensor.

standing: provisionalI2C / SPII2C 0x1E (fixed); 3-wire SPI
VendorSTMicroelectronicsIMU & Motion
InterfaceI2C / SPII2C 0x1E (fixed); 3-wire SPI
Record StatusCatalog profileDatasheet / behavioral twin

Driver oracle & capability record

Tracked on micro:bit v2 Zephyr builds in the CircuitTwin confidence registry and indexed in the datasheet corpus.

Driver referenceZephyr lis2mdl / ST lis2mdl-pid
Evidence standingprovisional (register and bus behavior derived from vendor datasheet or driver oracle; not yet hardware-unit verified on two physical samples).
Published recordGenerate or inspect locally via ct twin generate (see /docs/twin-generation).

Key registers & reset values

Address / FieldRegisterReset / ExpectedPurpose
0x4FWHO_AM_I0x40Fixed ST LIS2MDL chip ID
0x60CFG_REG_A0x03 (Idle)Temp comp, ODR (10..100 Hz) and mode bits
0x62CFG_REG_C0x00Block data update (BDU) and DRDY interrupt routing
0x68-0x6DOUTX_L..OUTZ_H16-bit LEMagnetic axis output words (1.5 mG/LSB)

Attach with ct CLI

Shell - run firmware with LIS2MDL
# Run compiled firmware with LIS2MDL attached on microbit-v2
ct run --json --board microbit-v2 --device lis2mdl build/app.elf

# Run fault-injection suite and emit JUnit XML
ct test run --json --junit results/lis2mdl.xml tests/lis2mdl-fault.suite.yaml

Fault-injection test snippet (suite.yaml)

tests/lis2mdl-fault.suite.yaml
version: 1
board: microbit-v2
firmware: build/app.elf
tests:
  - name: lis2mdl-i2c-nack-recovery
    faults:
      - at_ms: 30
        bus: I2C1
        kind: nack
        address: 0x1E
        count: 2
      - at_ms: 140
        part: lis2mdl
        kind: register_override
        register: 0x4F
        value: 0xFF
    expect:
      console_contains: "DRIVER_FAULT_HANDLED"
      exit_code: 0

Compatible board twins

More in IMU & Motion