Search by Tags

How to use Automotive Cluster example on Linux

 
Applicable for

Compare with Revision


Subscribe for this article updates

Overview

This article shows the Automotive Cluster demo running on the Qt framework on Toradex computer modules running Linux.

Automotive Cluster Display Demo

The instrument cluster is used to display information of the vehicle systems. This includes gauges for various parameters such as speed, rpm or fuel, as well as indicators, status lights and also acoustic effects.

Steps to Run the Demo

Download the OpenEmbedded repository

The automotive cluster example for Linux is based on OpenEmbedded (core), to build the example you have to follow OpenEmbedded (core) tutorial and change some steps.

The example has been tested with version V2.4, make sure to synchronize the repository with the correct version.

mkdir ~/oe-core
cd ~/oe-core
repo init -u http://git.toradex.com/toradex-bsp-platform.git -b LinuxImageV2.4
repo sync

Add Toradex extra layer

The “meta-toradex-extra” layer contains the Auomotive Cluster example. You need to manually download this layer using:

cd ~/oe-core/stuff
git clone https://github.com/toradex/meta-toradex-extra.git -b ew2015-automotive-cluster 
cd ~/oe-core/build

Compiling configuration

Source the “export” file, this will configure all the environment variables required for OpenEmbedded.

. export

At the “oe-core/build” directory we have to change two files before start the build. Change the file “local.conf” to configure the machine and add the automotive cluster package:

vim conf/local.conf

Add the qt-automotive-cluster-demo package as a preinstalled package by using the IMAGE_INSTALL variable:

#MACHINE ??= "qemux86"
#MACHINE ?= "colibri-t20"
MACHINE ?= "colibri-vf"
IMAGE_INSTALL_append = " qt-automotive-cluster-demo "

Change the bblayer.conf to include the “meta-toradex-extra”:

vim conf/bblayer.conf

Add the meta-toradex-extra layer:

# These layers hold machine specific content, aka Board Support Packages
BSPLAYERS ?= " \
  ${TOPDIR}/../stuff/meta-toradex \
  ${TOPDIR}/../stuff/meta-toradex-extra \
"

Now, run bitbake command to start the build.

bitbake console-trdx-image

Change Aplication Resolution

By default, Automotive Cluster example is configured to use 1024x600, you can change for 800x480 by removing the define in a “meta-toradex-extra” file.

vi meta-toradex-extra/recipes-qt/qt-automotive-cluster-demo/qt-automotive-cluster-demo_0.1.bb

Remove “DEFINES+=RESOLUTION_1024x600”

--EXTRA_QMAKEVARS_PRE += "CONFIG+=no-webcam DEFINES+=RESOLUTION_1024x600"
++EXTRA_QMAKEVARS_PRE += "CONFIG+=no-webcam"

Change Screen Resolutions

You can also change you screen resolution by setting the U-Boot variable (use a serial console to enter the U-Boot prompt):

set vidargs video=dcufb:1024x600
set vidargs video=dcufb:800x480

Use “save” to store this change permanently.

Building the qt user interface

If you want to build the Qt application you have to prepare the QT SDK, configure the Qt Creator and download the source code.

Prepare Qt SDK

To compile the SDK and setup Qt Creator, refer to this article:

How to set up QT Creator to cross compile for embedded Linux

Building the Qt User Interface using Qt Creator

The source code can be downloaded from the git repository QtAutomotiveClusterDemo:

cd ~/QtProjects/
git clone https://github.com/toradex/QtAutomotiveClusterDemo

If you build all the OpenEmbedded root file system the Automotive Cluster application will be started automatic by default. Before the application starts, the init script also exports some Qt specific environment variables.

However, when using Qt Creator one need to configure Qt Creator to set this environment variables accordingly. In the Projects "Run" settings, extend the "Run Environment" with these variables:

QWS_DISPLAY="LinuxFb:/dev/fb:genericcolors"
QWS_KEYBOARD="USB:/dev/input/event-keyboard"
QWS_MOUSE_PROTO="LinuxInput:/dev/input/event-mouse"

To use the touchscreen you have to be sure that your touchscreen driver is enabled and change the Qt environment variable to something like this (see also Resistive Touch Screen (Linux) and Capacitive Multi-Touch Display (Linux)):

QWS_MOUSE_PROTO: tslib:/dev/input/touchscreen0

Furthermore, add the argument "-qws" in the "Run" section in order to run directly on the Framebuffer device.