Tag Qt

CAT3626 RGB LED Driver + Qt Embedded 4.6 on the Mini2440

The CAT3626 is a nice little I2C device from ON Semiconductor. It comes in a 14 pin TQFN package which is probably the most difficult thing i've ever soldered! Each pad is separated from it's neighbour by about 100 micrometers! To make matters even more difficult there's a ground pad right in the middle for sinking heat away. Really you should get some sort of breakout board or reflow it but that would be boring! Here's a picture of the device before soldering:

image1

...and here's the finished product! The LED is 10mm diffuse with a common anode and a maximum current rating of 20mA per channel.  As soon as i'd soldered the wires to the CAT3626 i glued it to the board with epoxy, threaded the wires through the holes and then glued those down with more epoxy. After that i realised i'd forgotten where pin 1 had gone so i had to scrape the glue off the top of the chip!

image2

image3

The wire coming through the hole in the middle of this picture is soldered to the CAT3626 and acts as a crude heat sink. In practice it seems to work well enough although i probably should have used copper. I pulled the ceramics from an old projector i had lying around. Not the neatest job but it works fine!

After I'd built that i tested it quickly using I2C tools and then wrote a kernel driver.  The CAT3626 allows a maximum of 32mA per channel regulated in steps of 0.5mA. Unfortunately because my LED can take a maximum of 20mA per channel i can only generate ~64,000 colours. To make matters worse the light intensity is not in general a linear function of the input current so the achievable fade sequences are not as nice as those done with PWM but they still look pretty good. Here's a video!

Update: The kernel driver for the CAT3626 is now available for free on github!

Qt Embedded 4.6.0 + Qwt + kxps5 accelerometer!

After testing the operation of the kxps5 accelerometer with i2c-tools i wrote a test application using the i2c-dev interface. If you want to test your code before you write a kernel driver this is definately a good place to start. Once i had the configuration registers set properly and i had a routine for reading the acceleration vectors I stripped down a ds1621 kernel driver to a bare minimum, and then built it back up again to work with the kxps5. I then bitbaked the kxps5 driver as a kernel module, along with hwmon and it works perfectly! :) Next i cross compiled qwt 5.2.0 and plotted the acceleration as function of time. The video below is taken with antialiased lines which slows down the refresh rate but makes them look nice. If you plot it without this enabled it runs very smoothly. Here you see the kxps5 running without an external low pass filter (the internal filter is 1kHz) and despite this the output is pretty stable. What impressed me the most is the sensitivity. When placed on a desk the free fall interrupt indicator lights up if you drop one of the little nuts from the friendlyarm LCD about 10cm away from the device!

The kernel driver for this is now available here.

Bitbaking the kernel, Angstrom and qt4-embedded all at once

This is what i should have done to begin with! The instructions are very similar to previous ones except this time we clone the right git repository!

On a fresh copy of Fedora 11 I updated the system and installed the packages reccommended by OE:

su -c “yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip
python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl
docbook-style-xsl docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static
gcc binutils pcre pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools
gcc-c++ help2man perl-ExtUtils-MakeMaker”

I then made a folder called OE in my home directory and git cloned the mini2440 repo:

cd ~
mkdir OE
cd OE
git clone git://repo.or.cz/openembedded/mini2440.git openembedded

I then setup the source-me.txt similar to before:

gedit source-me.txt

I put the following in:

export OETREE="/home/doug/OE"

BBPATH=${OETREE}/:${OETREE}/openembedded/

echo Setting up dev env for Ångström

if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi

if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi

PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}

LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"

su -c 'sysctl vm.mmap_min_addr=0'

echo "Altered environment for OE Development"

Now all you need to do is setup the local.conf. Simply edit the example and copy it to the right place:

cd openembedded
gedit mini2440_local_conf_example.conf

Read this file and edit as appropriate. I have attached mine as an example. Now copy it to the conf/local.conf

cp mini2440_local_conf_example.conf conf/local.conf

If you want qt4-embedded or any other package included in the build simply edit the recipe in:

openembedded/recipes/images/mini2440-image.bb

I added qt4-embedded:

#Angstrom bootstrap image

IMAGE_PREPROCESS_COMMAND = "create_etc_timestamp"

ANGSTROM_EXTRA_INSTALL ?= ""

DEPENDS = "task-base-extended
psplash-zap
esekeyd u-boot-utils tslib
i2c-tools i2c screen rsync nfs-utils
directfb gdbserver directfb mtd-utils
"

IMAGE_INSTALL = "task-base-extended
${ANGSTROM_EXTRA_INSTALL}
psplash-zap qt4-embedded
esekeyd u-boot-utils tslib-calibrate tslib-tests
i2c-tools i2c screen rsync nfs-utils-client
directfb gdbserver directfb mtd-utils
rsvg pango
"

export IMAGE_BASENAME = "mini2440-image"
IMAGE_LINGUAS = ""

inherit image

Then all you have to do is source the script from wherever you put it:

source source-me.txt

and run bitbake:

bitbake mini2440-image

from the ~/OE/openembedded/ directory..

If you get an error trying to build a package try cleaning it:

bitbake -c clean INSERTPACKAGENAME

Then try and build the image again. Maybe you won't have this problem. I guess it's either because the checksum parser failed to build or my hdd is dodgy. It only happened once on binutils but worked fine after cleaning it.

A few hours later if all goes well you should have images in:

~/OE/oetmp/deploy/glibc/images/mini2440/

Obviously that directory depends on what you setup in the local.conf.

Good luck!

Building Angstrom

I've been meaning to put this up for a while. Providing nothing goes wrong the whole process is actually very easy! This is basically a rehash of the Angstrom webpage so you might prefer to follow that taking notes of the minor deviations below:

export OETREE="/home/doug/OE"
mkdir -p ${OETREE}

cd ${OETREE}
git clone git://git.openembedded.org/openembedded.git openembedded
cd openembedded
git checkout origin/stable/2009 -b stable/2009

To update the OE metadata simply:

cd ${OETREE}/openembedded
git pull

Now make the suggested script source-me.txt changing OETREE to suit your needs:

export OETREE="/home/doug/OE"

BBPATH=${OETREE}/:${OETREE}/build/:${OETREE}/openembedded/
PKGDIR=${OETREE}/build/
DL_DIR=${OETREE}/downloads
echo Setting up dev env for Ångström

if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi

if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi

PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}

cd $PKGDIR

LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"

echo "Altered environment for OE Development"

I also had to set:

sudo sysctl vm.mmap_min_addr=0

Then setup local.conf:

mkdir -p ${OETREE}/build/conf
cp ${OETREE}/openembedded/contrib/angstrom/local.conf ${OETREE}/build/conf/

Now edit ${OETREE}/build/conf/local.conf and add this to the end:

MACHINE = "mini2440"

Now download the mini2440 config file from openembedded. Put this in:

${OETREE}/openembedded/conf/machine/

Now source the source-me.txt, go to the OE tree, check it's up to date

source source-me.txt
cd ${OETREE}/openembedded
git pull - -rebase

Now build the images, you can build all of them or just one. I used the base image for running Qt but i also built the gpe image which worked nicely if you need it.

bitbake base-image ; bitbake console-image ; bitbake x11-image ; bitbake gpe-image

Be prepared to saturate your internet connection, wait a long time and take up a lot of disk space!

The result ends up in:

${OETREE}/angstrom-dev/deploy/glibc/images/mini2440

You should have the image(s) in .jffs2 for flashing and .tar.gz for mounting using NFS.

Cross compiling Qt-embedded 4.5.3

Cross compiling Qt was actually very easy. I used the same machine described in the mini2440 kernel post.  If you have a vanilla install of Fedora 11  it's more than likely you'll get some errors due to missing packages so check the list i posted if you can't figure out which ones you need. This is what i did:

  1. Download the Qt source from Trolltech
  2. Untar the archive somewhere, i simply used the desktop
  3. Edit the file mkspecs/qws/linux-arm-g++/qmake.conf according to your toolchain. I have attached mine here as an example. I used the toolchain from OpenEmbedded.
  4. Now run the following commands within the Qt directory:
  • .\ */configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian*
  • *gmake -j 2* (or however many CPUs you have)
  • sudo gmake install

The resulting ~74MB  will be located in /usr/local/Qt. At first i ran the library from an SD card using a system wide link but later i used NFS.

I ran the library using BusError's mini2440 kernel and an Angstrom base image I cross compiled using OpenEmbedded apriori. In my next post i'll describe how to compile Angstrom Linux for this purpose which also provides the toolchain i used here. Finally when i get access to my mini2440 i'll explain how to use the examples and setup the touch screen which was a little fiddly.

Big thanks to Cor for his post on building Qt which i've relied on heavily here.

Qt 4.5 for Embedded Linux: Fluid Launcher Demo

After a lot of messing around i cross compiled the mini2440 kernel (massive thanks to buserror) , the Angstrom Linux distribution and Qt 4.5 for Embedded Linux. I was impressed by how quickly the demos run, check out the video below  if you're interested:

When i get some time  i'll post up some more information on how i got this to work.