How to connect an Accelerometer (byteSENSI-A) to the byteDEVKIT OSM-S

Picture Devkit with Accelerometer
Picture Devkit with Accelerometer

Introduction

This guide walks through the process of adding the accelerometer BMA400 to the byteDEVKIT OSM-S with the OSM-S iMX93 byteENGINE module. First step is to connect the external hardware component to the byteDEVKIT. Afterwards, the Linux kernel is modified.

Step 1: Connect the Accelerometer BMA400

The accelerometer BMA400 board has the following pins:

  • VDD (1.62-3.6V)

  • SCL

  • SDA

  • I2C_ADDR_SELECT (GND: 0x14, VDDIO: 0x15)

  • INT

  • GND

Connect the pins with header cables to the 60 Pin Connector on the byteDEVKIT OSM-S.

The datasheet of the byteDEVKIT OSM-S shows the pinout of the 60 Pin Connector (3.6 X12 60PIN Connector). It can be downloaded from the bytesatwork downloads page: https://bytesatwork.io/de/downloads/datasheet-bytedevkit-osm-s-v1.0.pdf

The following table shows how to connect the BMA400 to the byteDEVKIT-OSM-S:

BMA400 SignalX12 PinSignal NameiMX93 Function
VDD23V3
SCL40I2C2.SCLLPI2C2_SCL
SDA42I2C2.SDALPI2C2_SDA
I2C_ADDR_SELECT19GPIO.A6GPIO2_IO08
INT21GPIO.A7GPIO2_IO09
GND60GND

See the relevant schematic parts to connect the two hardware boards with each other:

byteSENSI-A with BMA400
byteSENSI-A with BMA400
byteDEVKIT OSM-S - X12 60 Pin Connector
byteDEVKIT OSM-S - X12 60 Pin Connector

Step 2: Install Toolchain and Clone Kernel

To be able to build the linux kernel, the correct toolchain needs to be installed. Download and install the toolchain from byteWIKI:
https://bytewiki.readthedocs.io/en/latest/yocto/5.0/bytedevkit-imx93.html

Then clone the linux kernel repository for the iMX93:

git clone -b baw-lf-6.6.52-2.2.0 https://github.com/bytesatwork/linux-imx.git
cd linux-imx

Step 3: Add and enable Accelerometer in the Kernel

Firstly, the accelerometer is added to the device tree.

Open the device tree file arch/arm64/boot/dts/freescale/imx93-bytedevkit.dts and add the accelerometer in the i2c1 node:

&lpi2c1 {
	#address-cells = <1>;
	#size-cells = <0>;
	clock-frequency = <400000>;
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&pinctrl_lpi2c1>;
	pinctrl-1 = <&pinctrl_lpi2c1>;
	status = "okay";
	/* LVDS Touch */
	gt911@5d {
		...
	};
	accelerometer@14 {
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_accelerometer>;
		compatible = "bosch,bma400";
		reg = <0x14>;
		interrupt-parent = <&gpio2>;
		interrupts = <9 IRQ_TYPE_LEVEL_HIGH>;
	};
};

Also add the pincontrol for the accelerometer in the iomuxc node:

&iomuxc {
	pinctrl_accelerometer: accelerometer_grp {
		fsl,pins = <
			MX93_PAD_GPIO_IO08__GPIO2_IO08		0x100	/* I2C ADDRESS SEL */
			MX93_PAD_GPIO_IO09__GPIO2_IO09		0x0	/* INT */
		>;
	};
 
   ...
   
};

Next the driver needs to be enabled in the config.

Open the file arch/arm64/configs/bytedevkit_imx93_defconfig and append the following to lines to the end of the file:

CONFIG_BMA400=y
CONFIG_BMA400_I2C=y

Now the kernel image and device tree need to be built:

source /opt/poky-bytesatwork/5.0.5/environment-setup-cortexa55-poky-linux
make bytedevkit_imx93_defconfig
make -j4 Image freescale/imx93-bytedevkit.dtb

Copy the compiled image and device tree to the device. This can be done be writting it directly to the SD card or by copying it with scp to the running byteDEVKIT OSM.

To copy the files over scp, boot the byteDEVKIT OSM and connect the ethernet cable. Run ifconfig to get the IP address of the device. Then copy with scp:

arch/arm64/boot/Image
arch/arm64/boot/dts/freescale/imx93-bytedevkit.dtb

Need to be copied to the /boot/ folder of the byteDEVKIT OSM.

Step 4: Read accelerometer values

Boot the device with the new kernel. Connect to the device over the UART console.

Check what iio devices exist:

ls /sys/bus/iio/devices/

If multiple devices exist, use the name property to identify which device is the BMA400.


In this example device1 is the accelerometer:

ls /sys/bus/iio/devices/
iio:device0  iio:device1  trigger0
cat /sys/bus/iio/devices/iio:device0/name
imx93-adc
cat /sys/bus/iio/devices/iio:device1/name
bma400

Read the accelerometer measurements:

cat /sys/bus/iio/devices/iio:device1/in_accel_x_raw
cat /sys/bus/iio/devices/iio:device1/in_accel_y_raw
cat /sys/bus/iio/devices/iio:device1/in_accel_z_raw

Conclusion

With the BMA400 properly connected, described in the device tree, and enabled in the kernel, the accelerometer becomes accessible through the standard IIO interface on any byteENGINE OSM module. After booting the updated image, the sensor data is immediately available for testing or integration. This gives you a clean, repeatable path from hardware hookup to usable accelerometer output across the entire OSM platform.

Datenschutzhinweis

Diese Webseite nutzt externe Komponenten, wie z.B. Google Analytics, Google Maps, und Youtube, welche dazu genutzt werden können, Daten über Ihr Verhalten zu sammeln. Datenschutzinformationen

Notwendige Cookies werden immer geladen