Bosch BMA421¶
this driver does not exist, so it has been created. Still work in progress ….
west build -p -b pinetime samples/gui/lvaccel
Overview¶
BMA421 is not a part number available to the general public, and therefore all the supporting documentation and design resources are neither discussed in public forums, nor disclosed on GitHub.
CHIP_ID=0X11 (so the Bosch BMA423 drivers need to be adapted)
The Bosch documentation on the bma423 seems to apply to the bma421.
Requirements¶
for this sensor does not exist any driver, so here’s what I did to create one under zephyr
adapt CMakeLists.txt¶
~/zephyrproject-2/zephyr/drivers/sensor add_subdirectory_ifdef(CONFIG_BMA280 bma280) add_subdirectory_ifdef(CONFIG_BMA421 bma421)
adapt Kconfig¶
~/zephyrproject-2/zephyr/drivers/sensor
add yaml file¶
~/zephyrproject-2/zephyr/dts/bindings/sensor cp bosch,bma280-i2c.yaml bosch,bma421-i2c.yaml
edit KConfig¶
- source “drivers/sensor/bma280/Kconfig”
source “drivers/sensor/bma421/Kconfig”
source “drivers/sensor/bmc150_magn/Kconfig”
source “drivers/sensor/bme280/Kconfig”
create driver¶
see under drivers/sensor/bma421
complement the pinetime.dts file with the following (under samples/sensor/bma280)
&i2c1 {
bma421@18 {
compatible = "bosch,bma421";
reg = <0x18>;
label = "BMA421";
int1-gpios = <&gpio0 8 0>;
};
};
Create a file: /dts/bindings/sensor/bosch,bma421-i2c.yaml. Which contains:
compatible: "bosch,bma421"
include: i2c-device.yaml
properties:
int1-gpios:
type: phandle-array
required: false
Building and Running¶
Todo¶
the driver is interrupt driven as well – need to test software
the sensor has algorithm for steps – read out register
temperature some attempt has been made, but … (OK, temp can be read)
References¶
Bosch has documented the BMA423 very well. I kind of hope it will apply to the bma421.
A mechanism to adapt the 0x5E register is provided. (burst read/write)
All kind of parameters can be set to trigger an interrupt. (e.g. number of steps taken : think of the 10000 steps threshold)