Software Development for Laser Thickness Gauges on FriendlyARM Smart210

Short description: the task is to measure the cross section of the object between two moving laser sensors, the whole calculation is on the computer side.

Qt was chosen as a development tool due to the fact that it is a cross-platform product, as well as OpenSource. Qt installed the latest version 5.4 at that time. Initial use of the program was expected under Windows OS with a touch screen. Somewhere in the middle of the path, they decided to redo the Smart210.

Smart210 is the development of our Chinese brothers, with the ability to install OSes (included): WinCE 6, Linux, Qtopia, Android. The Debian build was also tested.

The target system on this device was originally Linux. Work with the controller of the thickness gauge is carried out through FT2232HL.

The use of proprietary FTDI drivers has a number of stages and features:

Disabling the standard ftdi_sio and usbserial libraries is required:

sudo rmmod ftdi_sio
sudo rmmod usbserial

This cannot be done without rebuilding the kernel with these libraries included as kernel modules.

The kernel was assembled using the toolschain arm-linux version 4.5.1, which was supplied by the manufacturer, an attempt to build the kernel with newer compilers led to the inoperability of the touch screen, because the friendlyarm-ts-mtinput module (responsible for multi touch screen operation) fell into errors, the ability to rebuild for new compilers is missing (no source).

In the mini210_linux_defconfig file, write the path to the compiler and configure as kernel modules:

CONFIG_CROSS_COMPILE="arm-linux-"
...
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_FTDI_SIO=m

Although CONFIG_USB_SERIAL = m includes all dependent libraries as kernel modules, including ftdi_sio (just in case, CONFIG_USB_SERIAL_FTDI_SIO = m). Then execute the command:

./build

Since the composition of the modules has changed, you must perform:

make modules

Then it remains to copy to the file system. The assembly of the file system by the yaffs2 utility included in the package from the disk caused a file error at the time of installation. I had to use the standard:

mkyaffs2 rootfs_rtm_210 rootfs_rtm_210.img

After the done manipulations, it became possible to use the FTDI library.
Qt for Linux took version 5.3.2 and compiled it with linuxfb support.

Subsequent use of this approach revealed insufficient drawing speed (the touch screen did not respond when drawing). Used to draw frame buffer, lack of driver support for OpenGL ES.

I stopped on Android, I had to redraw it to rewrite using ttyUSB, because the FTDI driver for Android exists only for Java.

When FTDI was disconnected and connected, the appearance of 0x00 bytes was detected, which led to a shift, and with a fixed data length of 10 bytes and without a sign of the beginning of the packet, it created a nuisance. In addition, a break (as an emergency could break the packet), the decision to search for the first 10 bytes tested on CRC8:

bool Controller::readBlockN(uchar *tmp, qint64  blockSize){
    int bytesReceived = 0;
    int bytesRead = 0;
    qint64 m_blockSize = blockSize;
    while (m_blockSize > 0) {
        bytesReceived = read(uart0_filestream, ((void*)&tmp_block) + bytesRead, m_blockSize);
        if (bytesReceived > 0){
            m_blockSize -= bytesReceived;
            bytesRead += bytesReceived;
            if (bytesRead > 9) {
                if (tmp_block[bytesRead - blockSize + 9] == getCRC8((uchar*)&tmp_block + bytesRead - blockSize, 9)){
                    memcpy(tmp, (uchar*)&tmp_block + bytesRead - blockSize, 10);
                }
                else{
                    m_blockSize = 1;
                }
            }
        }
    }
    return true;
}

At this stage, it was discovered that there are no rights to use ttyUSB * ports and this happens after each reboot. The solution is to insert a line when loading the program:

system("su -c 'chmod 777 /dev/ttyUSB*'");

It remained to remove the navigation panel (maximize the use of the screen, in addition, it is assumed that other applications will not start this device). The standard panel does not respond to hiding events and is always on top of all applications. I decided to just delete it:

system("su -c 'rm /system/app/SystemUI.apk'");

FriendlyARM has a battery that does not reset the time, but nevertheless decided to call the standard Android time date settings when the application starts:

system("am start -n com.android.settings/.DateTimeSettingsSetupWizard");


The graphics are fully traced in QgraphicsView:

System Status:



Manual Mode:



Automatic Mode:



Video:



Researches and results:

Debian:
Bulky, takes ~ 430MB in its pure form, there is support for OpenGL ES, the mesa driver is used. There is no support for multi touch screen.

Qtopia:
Lack of support for OpenGL ES, and indeed it has not been supported for a long time.

Linux (rootfs_rtm_210):
Lack of support for OpenGL ES, takes up very little space in its pure form ~ 15MB, with all libraries from Qt ~ 90MB installed, the operating system loading speed is slightly more than 8 seconds.

WinCE 6:
I did not test it seriously, I just rummaged in a binary file for a mention of OpenGL ES, and it would require a debate under CE. Time was running out and decided to postpone.

Android:
Supports OpenGL ES, takes ~ 215MB, and starts about 2 minutes.

Also popular now: