How To Connect I2C Device To BeagleBone AI-64.
PAJ7620 – Integrated Gesture Recognition Sensor
BBAI64 Configuration
Install the Device Tree configuration for I2C-2 for BBAI64
In the BBAI64 terminal type:
debian@BeagleBone:~$ cd /opt/source/dtb-5.10-ti-arm64/
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ git pull
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ make
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ sudo make install
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ git pull
To the /boot/firmware/extlinux/extlinux.conf add line: fdtoverlays /overlays/BONE-I2C2.dtbo
debian@BeagleBone:~$ cat /boot/firmware/extlinux/extlinux.conf
label Linux microSD
kernel /Image
append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
fdtdir /
fdtoverlays /overlays/BONE-I2C2.dtbo
initrd /initrd.img
Reboot the BBAI64
debian@BeagleBone:~$ sudo reboot
Connection to 192.168.7.2 closed by remote host.
Connection to 192.168.7.2 closed.
After reboot check if the I2C2 overlay is active.
debian@BeagleBone:~$ sudo beagle-version | grep UBOOT
UBOOT: Booted Device-Tree:[k3-j721e-beagleboneai64.dts]
UBOOT: Loaded Overlay:[BONE-I2C2.kernel]
Check the bone I2C devices
debian@BeagleBone:~$ ls -lah /dev/bone/i2c/
total 0
drwxr-xr-x 2 root root 60 Jan 1 1970 .
drwxr-xr-x 4 root root 80 Jan 1 1970 ..
lrwxrwxrwx 1 root root 11 Aug 7 13:25 2 -> ../../i2c-5
So the /dev/bone/i2c/2 is I2C-5
Check if the PAJ7620 is available from the BBAI64 I2C-5 line.
debian@BeagleBone:~$ i2cdetect -r 5
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-5 using receive byte commands.
I will probe address range 0x08-0x77.
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- 73 -- -- -- --
If you can see the address 0x73 the connection to PAJ7620 is correct.
To communicate with the senor I’m using the source code from https://github.com/acrandal/RevEng_PAJ7620 with modifications to comply with Linux.
Source Files
RevEng_PAJ7620.cpp library for PAJ7620
paj7620_demo.cpp gestures detect demo
paj7620_corners.cpp corners detect demo
paj7620_osb.cpp – object’s size and brightness demo