Modules that need to be called
The I/O used in this article mainly consists of the following three parts
? I²c interface
? UART interface
? USB interface
The hardware peripherals you need to use are as follows
Grove Digital Light Sensor
The UART transfer usb1.8v line mentioned above
Customization of the kernel
First we need to reconfigure the kernel to add our device drivers
Recompile the kernel
Download our latest Android 5.1 version on the 96board website
The official kernel currently does not recognize our i²c-optical sensors By default, so we need to recompile and add drivers to the kernel
First download the BSP package of Linux Android on the official website, clone it and compile it.
Compiling kernel directives
First switch to the source directory
Go to the Build directory
Lunch Msm8916_64-userdebug
Start kernel config: Execute command
Make-j8 Kernelconfig
Note: J8 is the number of computer cores, depending on the configuration of the computer we are compiling
Next we can see the interface as shown in the interface:
Select Taos tsl2560,tsl2562 and TSL2563 ambient light sensor in the kernel compilation option
Save and exit from kernel Configmenu
If we add a new driver to the device, we need to make the changes in the makefile and add the correct path to the Kconfig file in the Kernel/driovers, which can be traced back to the correct device driver kconfig file. This step allows you to add a new portal to the kernel config, allowing you to choose between the Config interface and the driver file to be added to the same directory as the Kconfig file and the makefile file
Open/kernel/arch/amd64/boot/dts/qcom/apq8016-sb.dtsi and add the following code
&SOC {
[Email protected] {
[Email protected] {/* Grove Digital Light sensor */
compatible = "taos,tsl2561";
Reg = <0x29>;
}
Save the file and run the following command:
Make–j8 bootimage
Boot.img will be in/out/target/product/msm8916_64/boot.img
78B6000 is the address of BLSP for configuring I²c communication, and we connect this sensor to the i2c-0 device
Write kernel to Dragonboard 410c
We can set the 410c to FastBoot mode by holding down the button volume key at power-up. Once in FastBoot mode, we can use the command line boot.img burn to 410c
FastBoot Flash Boot boot.img
Connect the J8 pin on the Dragonboard 410c to the PCA9306 sensor
Connect as follows:
PIN #37?? VREF2 of PCA9306?? VCC of Grove Light sensor
PIN #39?? " -"On Bread Board
PIN #35?? VREF1 of PCA9306
PIN #15 (I2C0_SCL)?? SCL1 of PCA9306
PIN #17 (I2C0_SDA)?? SDA1 of PCA9306
PCA9306 GND to '-' on Bread Board
VREF2 of PCA9306?? VCC of Digital Light Sensor
SCL2 of PCA9306?? SCL of Digital Light Sensor
SDA2 of PCA9306?? SDA of Digital Light Sensor
"-" from Bread Board?? GND of Digital Light Senso
Connect the UART to the USB cable to the computer
PIN #11 Uart1_tx
PIN #13 Uart1_rx
PIN #1 GND
Refer to my article to connect
Test hardware
According to the above operation, we can already detect the device after boot.
The following information is first found in the trace of kernel:
tsl2563 0-0029:model 5, rev. 0
If you do not have a USB to UART, we can login via adb
ADB shell
Su
Dmesg
As the shell starts, we go into the directory/sys/bus/i2c/devices/i2c-0
We can see that the device 0-0029,0x29 represents the sensor's I²C address.
Cd/sys/bus/i2c/devices/i2c-0/0-0029/iio:device0
Cat In_illuminance0_input
Next we can see an integer value as the output, constantly masking or hitting the sensor, and performing
Cat In_illuminance0_input
instruction, we can see an ever-changing optical flow value.
410C Control I²c Optical flow sensor for hands-on Android system