Hardware Setup

This is the CCS811 Air Quality Sensor. CCS811

It can sense a wide range of Total Volatile Organic Compounds. This means that it can measure the level of, for example, CO2(carbon dioxide) in the room, so it gives us information about the indoor air quality. This is the block diagram from the datasheet: Block Diagram

As mentioned in a previous post, my job is to write a driver for this sensor, using the IIO interface. The sensor comes on a breakout board, as you can see in the pictures. This allows us to use it as an I2C device, but I still need a way to connect it to my system.

For this reason, NEO comes to rescue:

Neo

Just kidding, this NEO, UDOO NEO:

UDOO NEO

The UDOO NEO is an open hardware computer that embeds 2 cores(1GHz ARM® Cortex-A9 and ARM Cortex-M4) on the same processor(NXP i.MX 6SoloX). You can see full specs here: https://www.udoo.org/udoo-neo/.

As additional memory for the UDOO NEO, I’ve received a microSD card that holds the bootloader, the Linux Kernel and a File System.

Putting all the parts together:

hardware

Now, regarding the software, the first step is to clone the kernel:

git clone https://www.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git

The next step is to compile it. UDOO NEO has a different architecture than my machine. When the host(the computer on which the compiler runs: my machine) has a different architecture than the target(the computer on which we want the program to run: UDOO) we need to use a cross-compiler. As suggested on UDOO website, the following packages are required:

sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat libsdl1.2-dev xterm picocom ncurses-dev lzop \
     gcc-arm-linux-gnueabihf

Then, after choosing the right configuration, we compile the sources:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage -j5

The ARCH variable specifies that we want to compile for an ARM architecture and CROSS_COMPILE is the prefix appended to the name of the tools used to generate the executables. The “-jX” parameter specifies the number of threads used.

After the compilation is ready, we run:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbs -j5

in order to compile the device trees, and then:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules -j5

for the modules. Now, we can copy the kernel to the SD card.

This is it! The setup is done!

Written on June 17, 2017