- HARDWARE CONNECTIONS
- IMPLEMENTATION AND TESTING
This document explains how to generate and compile a custom Linux application on the UDOO NEO board for using the GPIO headers to connect a 16x2 LCD.
First of all, the Linux image used is UDOObuntu 2 RC1 (Ubuntu 14.04), available for download from the following link:
For creating a bootable SD card and other basic setup please refer to the following guidelines:
Then, it is required to install the proper drivers to ensure connectivity, including USB communication with Linux terminal of the target board. Please refer to the link below:
The LCD driver of this document was already implemented on a previous application, and could be found on the following document:
Customizing MQX applications on i.MX6SX.
3. HARDWARE CONNECTIONS
Now, the hardware connection considers a 4-bit interface to the LCD plus the Register Select (RS) and Enable (E) pins, so, six GPIO are used. For this example, digital input/output pins are used as shown on the following figure (purple rectangle):
4. IMPLEMENTATION AND TESTING
After booting Linux, a text editor like nano should be used to generate the program. The three main configurations for GPIOS are the following (using the E pin as example):
- Export the GPIO.
echo 148 > /sys/class/gpio/export
- Configure the direction of the GPIO (as output).
echo out > /sys/class/gpio/gpio148/direction
- Set the GPIO value to Low or High:
echo 0 > /sys/class/gpio/gpio148/value echo 1 > /sys/class/gpio/gpio148/value
So, based on these configurations and the LCD driver already implemented on the document mentioned on Requirements section, the complete C application for Linux could be generated (find it attached).
The GCC compiler already included on the UDOObuntu image could be used to generate the executable application. The picture below shows the terminal of the UDOO NEO board including the text editor, compilation and execution commands of the application.
The used commands are the following:
$ nano lcd16x2_imx6sx.c $ sudo gcc lcd16x2_imx6sx.c -o lcd $ sudo ./lcd
Finally, the following image shows the LCD with the application working on the UDOO NEO board, connecting the LCD using a proto shield:
NOTE: Ensure that M4 core is not running or using the same pins, in order to avoid unexpected behavior on GPIOs.
Original Attachment has been moved to: lcd16x2_imx6sx.c.zip