Everday in the market there are several sensors, devices, peripherals, etc manufactured and released for public use. Each of these devices are responsible for data collection and sensing parameters. These devices needs to be successfully interfaced to the microcontrollers for their use. In order to enable this device drivers come into the picture by providing suitable mechanism for interfacing the devices with the sensors.

The aim of the project is to develop a Linux device driver for a multi-display LED I2C controller LTC3206 using Embedded Linux Kernel. Understanding the Linux Kernel architecture is central for developing this project. A driver communicates with the device through the computer bus or communications subsystem to which the hardware connects. When a calling program invokes a routine in the driver, the driver issues commands to the device. Once the device sends data back to the driver, the driver may invoke routines in the original calling program. The main purpose of device drivers is to provide abstraction by acting as a translator between a hardware device and the applications or operating systems that uses it. This project targets to develop the same for a multi-display LED I2C controller.

I built the project by following the below steps:

Building and compiling the Linux Kernel for Raspberry Pi: The Linux 4.9 LTS was downloaded for this project. Before building it cross compilation tools were downloaded and installed. Before building the project I2C functions were enabled for ARM.

Setting up Eclipse: Linux build was imported. Path variables were set and built settings were changed for cross-compilation and deployment on Raspberry Pi.

Making modifications in BCM2835 device tree: LEDs were registered in the BCM 2835 device tree map.

Writing the driver with functions like led_control(), led_probe(), etc: The driver file was created with functions such as probe(), led_control(), etc. These were created for registration of the device and for its control. Below is an example code snippet:

Creation of Makefile and Deployment in Raspberry Pi: Three buttons were created for cleaning existing builds and deployment in Raspberry Pi.

There are several challenges that I ran into while doing my project: After successfully interfacing the LED controller sometimes the LED didn’t turn on which could be because of many reasons: 1> Pin configuration for SDA and SCL might be wrong. 2> Not setting up correct values for the command.

This project has helped me gain a lot of experience about the Embedded Linux Kernel. Working on the project has helped me become familiar and gave me with a hands on experience with different structures and areas of Embedded Linux Kernel. This project has taught me how to be methodical with my approach as this project involved multiple steps in building it. Also the project familiarized me with plethora of Linux shell commands. There are certain things which could have been done differently like the environment where the project has been configured. Also this project helped me become familiar with different concepts involved with device drivers and successfully interfacing it with Raspberry Pi. As part of this project, I encountered many unanticipated problems and errors while configuring the LED I2C controller. This has lead to non-detection of I2C controller and I realized there is a lot of intricacy involved with writing the driver. Debugging it has been a very challenging and a intellectually fruitful experience.

The next step of this project would be developing full stack API functions enabling the user to control the LED controller by just writing simple programs

Built With

Share this project:

Updates