HOWTO: Getting the LCD7 touchscreen recognized by the BEAGLEBONE using built-in ADC

Synopsis

The Angstrom distribution that ships with BeagleBone, has built-in support for touch screen. However, when downloading and installing the UBUNTU GNU Linux system, end-users may experience that their board does not recognize the LCD7 touchscreen, supplied by www.beagleboardtoys.com .

This short document will try to explain the steps to get a touchscreen system set up onto your beaglebone.

Problem

Unless that the kernel is compiled with the ‘fbcon’ and ‘ti_tscadc’ modules, the touch screen may not be recognized by any x-window based Ubuntu (or even Debian) installations. That said, the only way to interact with the system is with a mouse.

My setup

  • beaglebone
  • beaglebone LCD7 cape
  • 3 A, 5V power supply
  • a variety of SD cards to toy around, with at least 2 gigs, and Ubuntu 12.04 installed from minimal image (http://elinux.org/BeagleBoardUbuntu )

Setting up…

Assuming you’ve installed Ubuntu on an SD Card, we will skip those processes. If you haven’t set up Ubuntu on your SD Card for your Beaglebone, it is suggested that you give this link a try : http://elinux.org/BeagleBoardUbuntu. Get familiar with those steps prior to continuing. Make sure you’ve got your LCD working. LCD means the display in this context and not the touch screen. In addition, make sure the network is working on it too as we will be installing VIM (sudo-apt-get install vim).

Boot up your BeagleBone, and access the terminal. You can log into a terminal session and then :

sudo vim /etc/modules

(To learn the basics of vim, please refer to http://www.pixelbeat.org/vim.tips.html . The usage of vim is best described there.)

Basically, /etc/modules must be edited but you must have root privileges.

Add to the end of the file :

fbcon

ti_tscadc

… then save your file. (quite possibly the :w command in your vim session. If you have problems, refer to that link I provided.)

After exhausting research, what I think is going on is that in order to get the touchscreen driver working, the fbcon module supplies ti_tscadc with the dimensions of the target screen, being your LCD7. Therefore, fbcon MUST be loaded first, then ti_tscadc.

Your LCD7 screen, from electrical schematics I’ve read, uses AIN0-AIN3 for touchscreen input. In addition, ti_tscadc takes care of reading the four analog inputs (because it’s 4 wire device). (Refer to http://processors.wiki.ti.com/index.php/AM335x_Touchscreen_Driver’s_Guide#Driver_Usage for more technical details. However, don’t do like I did and waste 10 hours to get the thing working only by using that as a reference!)

Linux, unlike Windows, from what I can understand, treats most if not all devices as some kind of a mountable device object. In this case, /dev/input/mouse0 (or /dev/input/mouse1) are all valid entries. One of them happens to be your mouse block device too. You can sudo cat /dev/input/mouse0 (or mouse1) and see the data output as you fumble around. Any random gibberish (gibberish to us, data for the computer) is the raw data.

Conclusion

The Angstrom distribution of linux provides a good starting point to test the capabilities of your board. However, as many people prefer Ubuntu, this guide is intended to get your BEAGLEBONE with LCD7 (or any touch panel device using AIN0-AIN3 as analog touchscreen input). Modifying your /etc/modules to include fbcon and ti_tscadc modules should resolve your issues.

Unfortunately, I work as a long haul truck driver, and my postings will be spotty at best. Some people will grasp these instructions as much as some won’t and given the complexity of this topic, I won’t be surprised. However, Linux is a well supported platform, and you should not discourage yourself. Perseverance works wonders!

I am also aware that you can create a kernel with those mentionned modules so you won’t have to deal with these instructions.

AIN4-AIN7 should also be available for your needs too.

Also, on an unrelated note, I’ve learned that touchscreens are not true linear devices in the core, and therefore having a dedicated driver makes things a lot easier on you. So, if you had a hairy-brained scheme like me (who which my 10 years of truck driving kinda polluted my mind) to use simple mathematics and to read directly the ain0-ain3 values, you’re out of luck. (Yes, I am aware that some instructions refers as port AIN0 as AIN1, AIN1 as AIN2 and so forth…)

Oh… and if you didn’t know, take a look at the /sys/devices/platform directory. It’s a candy store full of neat files and directories to control your I/O.

Have fun and cheers!
Keep your shiny screen up , and circuit smoke off :slight_smile:

Danno

Mr. Danno Cardinal — veteran long haul truck driver (lorry driver), and embedded computing enthusiast

“25 years of computing tinkering, and only 8 in trucking…”

Hallo Danno,

I use Your configuration within the Beaglebone LCD3 cape and it works fine.
Can You give me an advice how to calibrate the touchscreen?

with best regards

Juergen