This article shows how to build all required elements to run the Colibri VF61 real-time demo using an XY pen plotter. The demo shows the real-time capabilities of the Toradex​ Colibri VF61 computer on module on a real world problem. The NXP/Freescale Vybrid based module has two cores, an ARM Cortex A5 along with a Cortex M4. The XY pen plotter is controlled by a custom eCos® RTOS based firmware on the Cortex M4 core. The user interface is created using Qt® running on Linux.

The hardware is from Makeblock with some improvements on the mechanics side for better reliability. Instead of using Arduino the plotter is connected to our Colibri VF61 via an Iris carrier board. For easier handling of the whole demo setup we developed a custom connector board. You can refer to the schematics of that board when attempting to connect such a printer to the Iris carrier board.

To run this demo no hardware (apart from a Colibri VF61 module and its accompanying carrier board) is required. Of course, you won't get anything plotted but for studying/understanding the whole setup it is usually good enough. The firmware and the user interface work even without any hardware connected since the stepper motors are controlled by stepwise GPIO impulses without any feedback loop. The only feedback we get from the hardware are the two limiting switches used for reference at start-up. However the referencing times out after about 10 seconds and the firmware subsequently behaves as if the referencing actually succeeded.

There are multiple options on how to communicate and run the firmware. By default we use the MultiCore Communication (MCC) library and the firmware is running from DRAM.

The Linux image is a custom image which can be built using the OpenEmbedded core build system. The image contains Qt 4.8 libraries as well as utilities to load the firmware into the Cortex M4 core. The additional "meta-xypenplotter" layer adds the additionally needed recipes for software packages and the image.

Once the Linux image is deployed, it is time to deploy the Qt application itself. Our demo requires a Qt development environment to build and deploy the UI. For a real project, to gain better reproducibility and easier deployment of the root file system including the Qt application, it is recommended to create an OpenEmbedded core recipe which would build the Qt based user interface and include it into the image directly.

The touchscreen uses tslib, which needs to be configured explicitly for Qt Embedded using an environment variable on the target. In order to make touchscreen work when running the application out of QtCreator, the "Run Environment" needs to be configured in the Project settings:

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.

At this point, you should see the Qt user interface on the target.

A close look at the output shows that loading the firmware to the Cortex M4 currently fails. This is to be expected since the firmware is not deployed yet:

Loading firmware...
mqxboot: returned 1

By default, the UI is deployed to /opt/xypenplotter/. The the pre-installed start scripts from the meta-xypenplotter layer will start the user interface on next startup.

This step builds the firmware running on the Cortex M4 which controls the printer hardware (limiting switches, magnetics and stepper motor). As the first step, the pre-requisites to build eCos applications or kernels need to be prepared. Refer to the main eCos article (eCos on Colibri VF61 Cortex M4) or directly to the documentation provided in the eCos distribution on git.toradex.com (PDF format from our doc server).

Instead of building the firmware, one can also download a pre-built version (using MCC and running from DRAM): plotter.bin. Copy the firmware into the /var/cache/xyplotter/plotter.bin folder of your target.

The XY Pen Plotter firmware is available from Github as well. eCos provides two options as startup location (DRAM/OCRAM), both are fine for the XY Pen Plotter firmware. However, the Qt user interface loads the binary by default into the OCRAM (which is also the default location of eCos).

At this point you need to alter the make.sh script and add the cross compiler to the PATH. If one wants to use the self built eCos Kernel, the BTPATH needs to point to the build-tree directory of the pre-built eCos Kernel.

Plotable images transferred to the firmware are in a binary format, while the image shown on the UI are SVG images. The readme of the Plotter firmware describes how to create the binary format from a SVG file XY Pen Plotter firmware. In a next development phase, one would include this converting process in the user interface. However, due to resource/time limitations we omitted that step.

The UI expects the SVG files to be in the folder /var/cache/xyplotter and to be named starting from image0.svg to image3.svg. The binary representation of those vector graphics have the same name but with the .bin ending.

Instead of using your own SVG files you can also get a set of SVG files and the converted binaries from our server:

Even without hardware, it is possible to run the demo. The Qt user interface will be started by the init script provided by meta-xypenplotter. The user interface then loads the firmware and starts to communicate. The user interface also shows the four SVG files placed under /var/cache/xyplotter. When starting to plot an image, the user interface downloads respective binary representation of that image, starts plotting it (digital IO's on Pin 15 through 20 will be used to instruct the stepper motors) and report back its progress. The progress bar on the user interface will reflect the plotting progress.