Running QT GUI with Touchscreen Print

 


This application note explains how to run a demo QT GUI with touchscreen on the K70 SOM under uClinux. The demo is shown in the following video.


Hardware Platform

The hardware platform is the Emcraft Systems' K70 system-on-module (SOM) plugged into the TWR-K70-SOM-BSB baseboard. The baseboard is installed into the Freescale Tower.

This demo assumes that one of the following LCD displays is mounted on Freescale Tower:

Installing the QT Add-On

Download the QT add-on for the Linux Cortex-M distribution. It includes the QT 4.7.3 sources and the qtdemo sample project.

Go to the top of your Linux Cortex-M installation and unpack the add-on:

[psl@ocean linux-cortexm-1.10.0]$ cd linux-cortexm-1.10.0
[psl@ocean linux-cortexm-1.10.0]$ tar jxf /tmp/qt-4.7.3-HEAD.tar.bz2
[psl@ocean linux-cortexm-1.10.0]$

This will add two new directories to your Linux Cortex-M installation:

[psl@ocean linux-cortexm-1.10.0]$ ls -ld A2F/qt-4.7.3 projects/qtdemo
drwxr-xr-x 18 psl users 4096 2012-06-25 16:44 A2F/qt-4.7.3
drwxr-xr-x 3 psl users 4096 2012-06-25 15:55 projects/qtdemo
[psl@ocean linux-cortexm-1.10.0]$


Installing the Demo

Step through the procedure described in projects/qtdemo/README in order to build the QT/E 4.7.3 sources and the qtdemo sample project. Use the qt-4.7.3/linux-cortexm-configure-mouse script to configure the demo for touch or USB mouse.

Note that the Linux project is configured for the Freescale TWR-LCD-RGB display. To use the demo with the TWR-PIM-41WVGA display, rebuild the project with the following kernel options enabled:

CONFIG_SPI
CONFIG_SPI_MASTER
CONFIG_SPI_BITBANG
CONFIG_SPI_GPIO
CONFIG_PANEL_NEC_NL8048HL11_01B_SPI
CONFIG_KINETIS_SPI2_GPIO

Do the following to enable these options in the kernel. From the project directory (projects/qtdemo), run make kmenuconfig, the kernel configuration GUI interface should appear. Go to Device Drivers, enable SPI Support, and then enter into the SPI Support menu. In there, enable Utilities for Bitbanging SPI masters, GPIO-based bitbanging SPI Master. Then return to Device Drivers and go to Graphics support. In there, enable NEC NL8048HL11-01B panel SPI initialization.

Then go to the top of the GUI menu and from there go to System Type -> Freescale Kinetis I/O interfaces. In there, check Enable SPI buses emulated using GPIO and then Enable the Kinetis SPI2 bus emulated using GPIO.

To provide the right touch calibration file for the Future LCD, make the following edit in the (qtdemo.initramfs):

- ifarch K70 slink /etc/pointercal pointercal.twr-lcd-rgb 777 0 0
+ ifarch K70 slink /etc/pointercal pointercal.fut-twr-pim-41wvga 777 0 0

Rebuilt the loadable kernel image by running make. The updated image (qtdemo.uImage) will have to be loaded to the target.

Note further Linux image has been built and validated in context of the Emcraft Systems Release 1.10.0. If you are using a different release, do the following to update to up-to-date release. From the project directory (projects/qtdemo), run make kmenuconfig and then exit is immediately saving the changes. This will sync the project kernel configuration with the up-to-date kernel configuration.


Running the Demo

Prepare the U-Boot environment before running the demo. Being at the U-Boot prompt, add the platform_lcd parameter to the bootargs variable. Run the following commands to specify the LCD display that you are using:

  • For the Freescale TWR-LCD-RGB:
  • K70-SOM> setenv bootargs ${bootargs} platform_lcd=twr-lcd-rgb
    K70-SOM> saveenv

  • For the Future Electronics TWR-PIM-41WVGA:
  • K70-SOM> setenv bootargs ${bootargs} platform_lcd=fut-twr-pim-41wvga
    K70-SOM> saveenv

Load the bootable Linux image (qtdemo.uImage in projects/qtdemo) to the target as described in Loading Linux Images via Ethernet and TFTP.