Our blog
How to install and configure Debian/Ubuntu on Beagleboard (xM), BeagleBone, and Pandaboard (ES)
Below is the simplest instruction of installing and configuring Debian/Ubuntu with LCD support.
- Go to https://github.com/RobertCNelson/netinstall, select required distro and proceed with mk_mmc.sh script. It will automatically download required files and configure minimal working system on your SD card.
-
Then, go to “boot” partition of your SD card, find file “uEnv.txt” and change parameter “dvimode” for 10″ AUO LCD (1024×600) and 7″ CPT LCD (1024×600, resistive touch):
"dvimode=1024x600MR-16@60"
or for 10″ LG LCD (1280×800, black frame) and new gen 7″ panels (1280×800, capacitive touch):
"dvimode=1280x800MR-16@60"
How to compile Android ICS with touchscreen support
This post was created with valuable help of Zhi Yong Woo and Benjamin Tissoires
OK, lets make our own Android ICS tablet based on PandaBoard and our 10″ LCD bundle. We will use Linaro 12.01 build.
Prerequisites
We will need Ubuntu 11.04 x64 as a host machine. I tried different others hosts including 10.04LTS and 11.10, but only 11.04 x64 gave me working result. You can install your machine in VirtualBox – that’s exactly what I did. Just turn on Intel virtualization (VT-x) option in BIOS an enable it in VirtualBox. Also, you will need around 40 Gbytes of free disk space.
Install required packages
sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \ x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \ libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \ libxml2-utils xsltproc libncurses5-dev libreadline6-dev \ gcc-arm-linux-gnueabi uboot-mkimage
Install Java JDK
Oracle forced to remove Java JDK from standard Ubuntu repository recently. Therefore, we will use small trick to install JDK.
wget https://raw.github.com/flexiondotorg/oab-java6/master/oab-java6.sh -O oab-java6.sh chmod +x oab-java6.sh sudo ./oab-java6.sh sudo apt-get install sun-java6-jdk
Install Linaro image tools
sudo add-apt-repository ppa:linaro-maintainers/tools sudo apt-get update sudo apt-get install linaro-image-tools
Install Repo tool
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo export PATH=$HOME/bin:$PATH chmod a+x ~/bin/repo
Download Android source code (Linaro 12.01)
export MANIFEST_REPO=git://android.git.linaro.org/platform/manifest.git export MANIFEST_BRANCH=linaro_android_4.0.3 export MANIFEST_FILENAME=landing-panda.xml mkdir ~/work mkdir ~/work/android cd ~/work/android repo init -u ${MANIFEST_REPO} -b ${MANIFEST_BRANCH} -m ${MANIFEST_FILENAME} repo sync
This will download > 2 Gb of sources and will take around one hour (highly depends on your Internet speed).
Download toolchain
cd ~/work wget --no-check-certificate http://releases.linaro.org/12.01/components/android/toolchain/4.6/android-toolchain-eabi-linaro-4.6-2012.01-2-2012-01-13_19-04-18-linux-x86.tar.bz2 tar -jxvf android-toolchain-eabi-linaro-4.6-2012.01-2-2012-01-13_19-04-18-linux-x86.tar.bz2
Build source code
cd ~/work/android export TARGET_PRODUCT=pandaboard export TARGET_SIMULATOR=false export TARGET_TOOLS_PREFIX=~/work/android-toolchain-eabi/bin/arm-linux-androideabi- make TARGET_PRODUCT=${TARGET_PRODUCT} TARGET_TOOLS_PREFIX=${TARGET_TOOLS_PREFIX} HOST_CC=gcc-4.5 HOST_CXX=g++-4.5 HOST_CPP=cpp-4.5 boottarball systemtarball userdatatarball
If you have multi-core processor, then you should try to use “make -jX …” to speed-up compilation. I used “make -j8 …” on my i7 processor. Compilation time highly depends on your computer and can vary from 20 minutes to several hours. So, have another cup of coffee and keep fingers crossed 🙂
Build source code
cd ~/work/android export TARGET_PRODUCT=pandaboard export TARGET_SIMULATOR=false export TARGET_TOOLS_PREFIX=~/work/android-toolchain-eabi/bin/arm-linux-androideabi- make TARGET_PRODUCT=${TARGET_PRODUCT} TARGET_TOOLS_PREFIX=${TARGET_TOOLS_PREFIX} HOST_CC=gcc-4.5 HOST_CXX=g++-4.5 HOST_CPP=cpp-4.5 boottarball systemtarball userdatatarball
If you have multi-core processor, then you should try to use “make -jX …” to speed-up compilation. I used “make -j8 …” on my i7 processor. Compilation time highly depends on your computer and can vary from 20 minutes to several hours.
Find out the name of your SD card device
Insert SD card and enter the following command:
df -h
You will see the list of storage devices, you should find out which one is your SD card. Mine has name “sdb”, and I will use it in the next command.
Install Android image to SD card
cd ~/work/android/out/target/product/pandaboard sudo linaro-android-media-create --mmc /dev/sdb --dev panda --system system.tar.bz2 --boot boot.tar.bz2 --userdata userdata.tar.bz2 sync
We use here “sdb” as a name of SD card. Now remove SD card and insert it again – you will see several partitions opened in separate windows.
Apply Android binary patch
Insert SD card and enter the following command:
cd ~/work wget http://releases.linaro.org/12.01/android/images/landing-panda/install-binaries.sh chmod a+x install-binaries.sh ./install-binaries.sh /dev/sdb2 sync
Here we again use “sdb” as a name of SD card (2 is added to point to system partition).
Set correct LCD resolution
Go to “/media/boot” folder (this is boot partition of your SD card), open file “boot.txt” and add the following arguments to “setenv bootargs …” string:
omapfb.mode=dvi:1024x600MR-24@60 consoleblank=0
Now save file. And enter the following command to generate boot script:
sudo mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n 'boot script' -d boot.txt boot.scr sync
Now we have working Android with correct LCD output, but our touchscreen doesn’t work. Well, that’s right time to recompile kernel to add touchscreen support. Lets’ proceed!
Configure kernel
cd ~work/android/kernel make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- panda_defconfig make ARCH=arm menuconfig
Now select this driver in configuration menu:
Device Drivers --> HID Devices --> Special HID drivers --> HID Multitouch panels
Save configuration and exit.
Build kernel and copy to boot partition on SD card
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage cp ~work/android/kernel/arch/arm/boot/uImage /media/boot sync
Now we have working touchscreen, but it works really weird – only left top corner is working as projected to whole screen. This is because Android gets HDMI default resolution (1920×1080) and assigns it to touchscreen. Our touchscreen is connected through USB and is considered as “external” device, so Android thinks it is related to HDMI input. Therefore we have to configure touchscreen to be considered as “internal” device (just set parameter . Then Android will assign DVI resolution to it.
Configure touchscreen resolution
- Connect Pandaboard to PC with mini-USB cable and run ADB utility (it is available in Android SDK)
- Get file from this link Vendor_2087_Product_0a01.idc and put it to your current folder
- Enter the following commands to remount Android file system in R/W mode and to copy configuration file:
adb remount adb push Vendor_2087_Product_0a01.idc /system/usr/idc/Vendor_2087_Product_0a01.idc adb sync
- Restart Pandaboard
- You should have fully working touchscreen now.
Here are links to built images, kernel and boot.scr file:
boot.tar.bz2
system.tar.bz2
userdata.tar.bz2
boot.scr
Kernel
Full SD card image (use DD or Win32DiskImage to write to card)
How to setup correct LCD resolution
Most of modern LCD panels have embedded EEPROM memory with I2C interface that stores important information about its capabilities (including LCD resolution). This data usually takes 128 bytes and is referred as Extended Display Identification Data (EDID). Linux kernel searches for available EEPROM memories during startup and read this data.
Our v2 PCB uses a little bit different approach. It does not provide direct access from baseboard to LCD EDID info. Instead of this, it has PIC controller with embedded EEPROM, that can be programmed with EDID information and will pretend to baseboard to be LCD EDID EEPROM. This was done for three main reasons:
- Baseboard (BeagleBoard/PandaBoard) uses 1.8V level for I2C bus, but LCD requires 3.3V. So, we saved couple bucks on level translator (and you saved as well :).
- We get LVDS cables from LCD supplier without these 4 lines for EDID access. This is normal situation for LCDs that are supplied for notebooks. Making custom LVDS cable would increase the final price of our bundle.
- Some displays have different modes of operation with different resolution. And you can easy program different EDID data to PIC controller and switch between them during start-up.
Our current PIC firmware (version 1.0) does not include EDID procedure. New version with EDID support will be published soon. Therefore, below is short guide on manual changing of LCD resolution for Ubuntu and Android.
Linux kernel allows to assign manual LCD resolution in bootargs supplied by u-boot. This is usually done by script called “boot.scr” in “boot” partition that is loaded and executed by u-boot. “boot.scr” has special format and usually is created with the help of “mkimage” util from source file called “boot.txt”. Below is example of my “boot.txt” that I use for Android (Linaro build 12.01):
setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" setenv bootcmd "fatload mmc 0:1 0x80200000 uImage; fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80200000 0x81600000" setenv bootargs "console=ttyO2,115200n8 rootwait ro earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M,1:24M omapfb.video_mode=1024x600MR-16@60 mem=456M@0x80000000 mem=512M@0xA0000000 init=/init androidboot.console=ttyO2" boot
and for Ubuntu:
fatload mmc 0:1 0x80000000 uImage fatload mmc 0:1 0x81600000 uInitrd setenv bootargs ro elevator=noop vram=12M omapfb.mode=dvi:1024x600MR-16@60 bootm 0x80000000 0x81600000
You should consider above “boot.txt” files as examples only, because they highly depend on OS and baseboard that you use.
The most important bootarg here is “omapfb.video_mode=1024x600MR-16@60” – that’s exactly where we setup LCD resolution. 1024×600 sets resolution, “M” indicates the kernel will calculate a VESA mode on-the-fly instead of using modedb look-up, the “R” indicates reduced blanking which is for LCD panels, “16” is the color depth, “@60” is the # of frames per second.
Lets generate “boot.scr” file with the following commands:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Run uImage" -d boot.txt boot.scr chmod a+x boot.scr
“mkimage” is available in package “uboot-mkimage”.
Now copy generate “boot.scr” file to boot partition on your SD card, unmount it, put into baseboard and try. You should have native 1024×600 resolution now.
How to control LCD backlight brightness
Brightness level in LCD panels is controlled by pulse-width modulation (PWM). PWM is a simple turning the switch between supply and load on and off at a fast rate. The longer the switch is on compared to the off periods, the higher the power supplied to the load is. The PWM switching frequency has to be much faster than what would affect the load, which is to say the device that uses the power. Typically, switching frequency is set to about 200 Hz in most LCD backlight control units.
The term duty cycle describes the proportion of time when switch is on to the regular period of time. A low duty cycle corresponds to low power (low brightness in our case), because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on (max. backlight brightness).
Below are several examples of different duty cycles. That’s exactly the waveforms that you can see with oscilloscope connected to pin 4 of connector CON4 on our v2 PCB.
PWM waveform is generated by PIC12 microcontroller (U3) on our PCB. The duty cycles of PWM depends on voltage measured on its pin 7 (AN0) that is used as an input to internal analog to digital converter (ADC). We supply our LCD bundle with ambient light sensor connected to this pin. PIC12 measures voltage 10 times every second, and smoothly changes PWM duty cycle. Full cycle of brightness change takes 2 seconds to avoid screen flickers. Here is short video that shows how this works.
For manual brightness change you can substitute ambient light sensor with 10K variable resistor.
Now you can turn knob to control brightness of screen. Please, be aware that it has the same delay of 2 seconds to change brightness to new level. And finally, short video of manual brightness control in action.
Also, you can increase default brightness level by adding resistor in parallel with light sensor. The lower value of resistor will provide higher default brightness level.