Quick Start
From an installed Analog Attach (see Installation) to an overlay on
the board, with the CLI. The example adds an ADXL345 accelerometer
(adi,adxl345) to a Raspberry Pi 4 running Kuiper: on the I2C bus
i2c_arm (also labelled i2c1) at address 0x1d, with its interrupt on
GPIO 27, rising edge. The Linux kernel tree is in ~/linux. Outputs are
shortened where marked with ….
Create the project folder and point it to the kernel tree. Setting
linuxbuilds the binding caches:$ mkdir -p ~/work/rpi4-adxl345 && cd ~/work/rpi4-adxl345 $ analog-attach config backend linux Set backend = linux $ analog-attach config linux ~/linux Indexing device bindings and compiling binding schemas... Set linux = /home/user/linux; Indexed 20263 compatibles from 4479 bindings and compiled binding schemas in 6.3s
Choose the board’s devicetree and name the overlay:
$ analog-attach config devicetree ~/linux/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts Set devicetree = /home/user/linux/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts $ analog-attach config workfile overlay.dtso Set workfile = /home/user/work/rpi4-adxl345/overlay.dtso (not created yet: 'analog-attach init' creates it)
Create the overlay and the build and deploy scripts:
$ analog-attach init Workspace ready Linux: /home/user/linux Devicetree: /home/user/linux/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts Overlay: /home/user/work/rpi4-adxl345/overlay.dtso (created) aa_build.sh: /home/user/work/rpi4-adxl345/aa_build.sh (created) aa_deploy.sh: /home/user/work/rpi4-adxl345/aa_deploy.sh (created) Variables: BOARD_IP = analog.local, BOARD_USER = analog, BOARD_PASSWORD as a secret (set now) …
Find the device:
$ analog-attach list devices adxl345 adi,adxl345 Analog Devices ADXL345/ADXL375 3-Axis Digital Accelerometers …
Add it on
i2c_armat0x1d(the name setsreg):$ analog-attach add adi,adxl345 --parent i2c_arm --name adxl345@1d --label accel Added adxl345@1d (label: accel) to /home/user/work/rpi4-adxl345/overlay.dtso Missing required: interrupt-parent, interrupts Set them with: update accel <property> <value>
Set the interrupt, GPIO 27 on a rising edge:
$ analog-attach update accel interrupt-parent '&gpio' Set interrupt-parent on accel $ analog-attach update accel interrupts 27 IRQ_TYPE_EDGE_RISING Set interrupts on accel
Validate.
i2c_armis disabled in the base devicetree, so enable it:$ analog-attach validate accel: warning: (node): parent i2c@7e804000 is not enabled (status "disabled"): Linux won't probe adxl345@1d note: Enable it: enable /soc/i2c@7e804000 No errors! (1 warning(s)) $ analog-attach enable i2c_arm Enabled i2c_arm in /home/user/work/rpi4-adxl345/overlay.dtso $ analog-attach validate No errors!Build the
.dtbo.dtcwarns aboutregbecause it compiles the fragment without its target bus; the warnings are expected:$ analog-attach build Building /home/user/work/rpi4-adxl345/overlay.dtso with AA_BUILD dtc -@ -I dts -O dtb -o /home/user/work/rpi4-adxl345/build/overlay.dtbo /home/user/work/rpi4-adxl345/overlay.dtso … Build completed successfully /home/user/work/rpi4-adxl345/build/overlay.dtbo
Give the board’s address (the default is
analog.local) and deploy.deployasks for the board’s password (useranalog), copies the overlay to the boot folder, addsdtoverlay=overlaytoconfig.txtand reboots the board:$ analog-attach config var BOARD_IP 10.42.0.196 Set variable BOARD_IP = 10.42.0.196 $ analog-attach deploy … Deploying /home/user/work/rpi4-adxl345/build/overlay.dtbo with AA_DEPLOY Checking analog@10.42.0.196 Copying overlay.dtbo to analog@10.42.0.196:<boot folder>/overlays/overlay.dtbo … Rebooting analog@10.42.0.196 Deploy completed successfully
When the board is back, check that the driver probed. The device
adxl345is listed, with itsaccel_x,accel_yandaccel_zchannels:iio_info -u ip:10.42.0.196 | grep -A3 adxl345
The full walkthrough, with the wiring and the readings, is Use case: Configure a device with the CLI only. To do the same in the GUI, see Use case: Configure a device with the GUI, or watch the walkthrough video of Use case: GUI with an AI agent, which shows the GUI from setup to a running board.