Hints

This document contains a collection of (maybe) useful hints and commands for developers to do various task inside the installed SECO North Yocto.

This is a growing document and not ment to reach any state of completeness like a manual, or similar.

[[TOC]]

Audio

Play sound

aplay /usr/share/sounds/alsa/*

Play click sequence

wget -P /tmp/ http://support.garz-fricke.com/projects/TestFiles/Audio/short_click_4_times.wav aplay /tmp/short_click_4_times.wav

Qt QML audio playback

```

Preparation

systemctl stop seco-show-demo

cat > /tmp/audio-playback.qml << 'EOF' import QtMultimedia 5.15 import QtQuick 2.15

Text { text: "Click Me!"; font.pointSize: 24; width: 150; height: 50;

Audio {
    id: playMusic
    source: "/usr/share/sounds/alsa/Front_Center.wav"
}
MouseArea {
    id: playArea
    anchors.fill: parent
    onPressed:  { playMusic.play() }
}

} EOF

qmlscene /tmp/audio-playback.qml ```

HDMI sound playback test

Test

Start speaker-test for HDMI card.

sh speaker-test -c 2 -t wav -D sysdefault:CARD=DWHDMI

Gstreamer sound playback test

Test

Play test audio source with gst-launch for a few seconds for both sound devices.

sh gst-launch-1.0 audiotestsrc ! audioconvert ! alsasink device=hw:0,0 gst-launch-1.0 audiotestsrc ! audioconvert ! alsasink device=hw:1,0

Expected results

Sound is played through the HDMI display if device=hw:0,0 is used. Sound is played through the speaker if device=hw:1,0 is used.

Bluetooth

Bluetooth is currently only basically supported. Commands used for a basic hardware test:

Tanaro V1.1

Note: There are devices which do not have R11 populated on the BT Uart's CTS line. These do not support bluetooth. ```

Connect the BT-Chip

rtkhciattach ttymxc3 rtkh5

hciconfig hci0 up

Scan for other BT-devices

hcitool scan ``` This currently does not work with yocto kirkstone.

BLE (SantVend v1.2)

Test

Read device version

sh /opt/ltp/testcases/bin/spi -m 0x1,0x09 -r 9 /dev/spidev2.0 /opt/ltp/testcases/bin/spi -m 0x1,0x09 -r 9 /dev/spidev2.0

Expected results

Second command return response (9 bytes): 84 09 00 41 00 02 00 ff ff


BLE (SantVend v1.3)

Test

Read the chip type and OS version

sh /opt/ltp/testcases/bin/spi -m 0x02,0x10,0x01,0x00,0x0F,0x01C -r 12 /dev/spidev2.0 /opt/ltp/testcases/bin/spi -m 0x02,0x10,0x01,0x00,0x0F,0x01C -r 12 /dev/spidev2.0

Expected results

Second command return response (12 bytes): 00 30 44 41 41 05 20 40 28 05 00 a9

CAN

CAN test

Test Setup

Test

  1. Setup can interfaces on both boards and check interface statistics.

sh ifconfig can0 down ip link set can0 up type can bitrate 1000000 ifconfig can0 up ifconfig can0

  1. On the device under test start candump.

sh candump can0

  1. On the reciver device run cangen and cansend.

sh cangen can0 -n 10 -v cansend can0 '5A1#11.22.33.44.55.66.77.88'

  1. On the device under test stop stop candump. On both boards check interface statistics. sh ifconfig can0

  2. Repeat steps 2,3 and 4 in other direction (candump on the second board and cangen with cansend on the first board).


Expected results

Interface was successfully setup on both devices. Information received by candump on one board corresponds to the information sent by the other. TX and RX counters were increased by the amount of sent and received packets. Counters for errors, dropped, overruns, frame, carrier and collisions did not increase. ```

Counter part is running TestCANW322.0.2.0.exe -s -v1 -x4

/opt/ltp/testcases/bin/can ```

Device boot time test

Test

Shutdown device and disconnect the power supply unit.

Start grabserial tool on host PC:

sh grabserial --verbose --device="/dev/ttyUSB0" --baud=115200 --time --match="Configuring DDR3 pads.*"

Power up the board.

Display

Test Setup

BLPATH=/sys/class/backlight/backlight/ MAXBRIGHTNESS=$(cat $BLPATH/maxbrightness) ACTUALBRIGHTNESS=$(cat $BLPATH/actualbrightness) echo "max brightness value: $MAXBRIGHTNESS" echo "actual brightness value: $ACTUALBRIGHTNESS" echo 0 > $BLPATH/brightness sleep 2 echo $(($MAXBRIGHTNESS/2)) > $BLPATH/brightness sleep 2 echo $MAXBRIGHTNESS > $BLPATH/brightness sleep 2 echo $ACTUALBRIGHTNESS > $BLPATH/brightness echo "done" EOF * Set output sections in /etc/xdg/weston/weston.ini as following. [output] name=LVDS-1 transform=normal mode=preferred

[output] name=HDMI-A-1 transform=normal mode=preferred ```


Backlight test

Test

Run prepared backlight-test.sh.

sh sh /tmp/backlight-test.sh

Expected results

During the test: - at first, LVDS display backlight will turn off; - after 2 seconds, it will turn on with half of maximum brightness level; - after 2 more seconds, brightness will be set to max brightness; - after 2 more seconds, brightness level will be set to pre-test value.


FB blank

Test

Stop weston.

sh systemctl stop weston.socket

Check if FB blanking works.

sh echo 4 > /sys/class/graphics/fb0/blank sleep 2 echo 0 > /sys/class/graphics/fb0/blank

Start weston again.

sh systemctl start weston

Expected results

On "echo 4" command, both displays stop showing any image (e.g. there is no signal for HDMI). On "echo 0" command, both displays turn on.


Single display LVDS test

Test

Set mode=off in /etc/xdg/weston/weston.ini for HDMI display. Set mode=preferred in /etc/xdg/weston/weston.ini for LVDS display. Restart weston and check weston-info.

sh systemctl restart weston weston-info

Expected results

Image is shown only on LVDS display. Weston-info shows only one working display - LVDS.


Single display HDMI test

Test

Set mode=preferred in /etc/xdg/weston/weston.ini for HDMI display. Set mode=off in /etc/xdg/weston/weston.ini for LVDS display. Restart weston and check weston-info.

sh systemctl restart weston weston-info

Expected results

Image is shown only on HDMI display. Weston-info shows only one working display - HDMI.


Dual display test

Test

Set mode=preferred in /etc/xdg/weston/weston.ini for HDMI display. Set mode=preferred in /etc/xdg/weston/weston.ini for LVDS display. Restart weston and check weston-info.

sh systemctl restart weston weston-info

Expected results

Image is shown on both displays. Weston-info shows that both display are enabled.


Weston rotation

Set different output rotation values. It is assumed that only one output is present in weston.ini. ```

Preperation

systemctl stop seco-show-demo

90 deg

sed -i 's/transform=.*$/transform=rotate-90/g' /etc/xdg/weston/weston.ini systemctl restart weston weston-image /usr/share/seco-show-demo/images/icon-hw-info.png

270 deg

sed -i 's/transform=.*$/transform=rotate-270/g' /etc/xdg/weston/weston.ini systemctl restart weston weston-image /usr/share/seco-show-demo/images/icon-hw-info.png

180 deg

sed -i 's/transform=.*$/transform=rotate-180/g' /etc/xdg/weston/weston.ini systemctl restart weston weston-image /usr/share/seco-show-demo/images/icon-hw-info.png

0 degree

sed -i 's/transform=.*$/transform=normal/g' /etc/xdg/weston/weston.ini systemctl restart weston weston-image /usr/share/seco-show-demo/images/icon-hw-info.png ```

EEPROM

EEPROM read

gfeeprom --show

EEPROM write

Before you run the write command verify the content of eeprom-orig.txt. Otherwise the original eeprom values may get lost. ```

Perperation

output=$(gfeeprom --show | grep "0-0050/eeprom ->") eval e=($(echo $output | sed -e 's/[>|()]//g' )) echo "[BEGIN] Controller Index = 1 Device = ${e[1]} EEPROM Address = 0x${e[1]##eeprom} Major Version = ${e[12]} Minor Version = ${e[14]} Article Number = ${e[7]} Serial Number = ${e[10]} Component = ${e[4]} Comment = ${e[16]} Verify = 0x1 Force write = 0x1 [END]" > /tmp/eeprom-orig.txt comment="Write test $(date)" sed "s/Comment =./Comment = ${comment}/" /tmp/eeprom-orig.txt > /tmp/eeprom-test.txt

cat /tmp/eeprom-orig.txt

Write to eeprom and read back

gfeeprom --program -sf /tmp/eeprom-test.txt gfeeprom --show

Restore original values

gfeeprom --program -sf /tmp/eeprom-orig.txt ```

Ethernet

Test Setup

DNS lookup test

nslookup north.seco.com

Performance test

Connect only the interface that is to be tested to the network. Run iperf client on the board to check upload speed:

sh iperf3 -c <server_ip> -P4

Run iperf client on the board to check download speed:

sh iperf3 -c <server_ip> -P4 -R

iperf3 -c <hostname/ip of echo server machine> -p 5201

Expected results

Upload/download speed is greater that 90 Mbit/sec.


Firewall

Basic test of the iptables functionality.

Ping and port scan

On the target, block all traffic: iptables -A INPUT -j DROP

On the remote device: ``` export DEVICE={Test device IP address}

ping $DEVICE -c3 -W1 for i in {1..255}; do ( ( nc -w 1 -n $DEVICE $i < /dev/null > /dev/null && echo -en "\r" && echo -n "Port $i: " && nc -v $DEVICE $i < /dev/null; echo -en "\r") & ); done ```

Ping should fail and no open port should be reported.

Validate http access

On the target, block all traffic but open port 80 and 53 (for dns)

iptables -F iptables -A INPUT -j DROP iptables -I INPUT 1 -p udp --source-port 53 -j ACCEPT iptables -I OUTPUT 1 -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -I INPUT 1 -i eth0 -p tcp -m state --state ESTABLISHED -j ACCEPT Try to download a webside from the internet: wget www.google.de

Simple systemd service to configure iptables on startup

Write the current setup from the previous test to the config file:

iptables-save > /etc/iptables/iptables.rules

Verify the rules are applied after reboot.

HDMI

HDMI DRM device

Check if a HDMI DRM device was created. ls /sys/class/drm/ | grep HDMI

HDMI modetest

Use modetest -c and modetest -p to find out which connector and crtc values (\

systemctl stop weston modetest -M imx-drm -s 66@47:1280x800

Weston on HDMI

Get connector name for HDMI:

root@localhost:~# ls /sys/class/drm/ | grep HDMI card1-HDMI-A-1

Change weston.ini accordingly:

[output] name=HDMI-A-1 ...

Reboot the device.

Light sensor (SantVend)

Test Setup


Light sensor test

Test

Check light sensor reading with different illumination levels.

sh cat /sys/bus/iio/devices/iio\:device0/in_illuminance_input

Expected results

The dimmer the illumination, the lower the light sensors reading will be.

MDB (SantVend)

Test Setup


MDB test

Test

  1. Start slave test on SantVend board with slave part of the MDB cable:

sh mdbtest_slave ttymxc3

  1. Start master test on SantVend board with master part of the MDB cable:

sh mdbtest_master ttymxc2

Expected results

Communication between test application is established. There are no errors during transfer. Reply messages from slave are seen on master. Slave reported "POLL count: 1" at the end.

Modem

Test Setup


Start Quectel EC21 LTE modem

Test

Clean dmesg buffer and reset modem:

```sh dmesg -C

MODEMRESET=$(gpiofind modemreset) gpioset $MODEMRESET=1; sleep 1; gpioset $MODEMRESET=0

MODEMIGN=$(gpiofind modemignition) gpioset $MODEMIGN=0; sleep 0.5; gpioset $MODEMIGN=1; sleep 1; gpioset $MODEM_IGN=0 ```

Check kernel messages.

sh dmesg

Check loaded modules.

sh lsmod

Expected results

USB/Network drivers successfully loaded after modem reset/ignition. There are no errors in dmesg. The following drivers are loaded as modules: "qcserial", "qmiwwan", "cdcwdm", "option", "usb_wwan", "usbserial".

AT commands test

Test

Run AT command to query vendor name.

sh echo -ne "AT+CGMI\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p"

Run AT command to query model number.

sh echo -ne "AT+CGMM\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p"

Retrieve info from SIM card:

sh echo -ne "AT+CFUN=1\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p" echo -ne "AT+CPIN?\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p" echo -ne "AT+CSQ\\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p" echo -ne "AT+COPS?\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p" echo -ne "AT+CNUM\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4 | sed -n "2p" echo -ne "AT+QECCNUM=0,1\r\n" | microcom -t 100 -s 115200 /dev/ttymxc4

Expected results

AT commands shows:

NFS

NFS client

Change the variables NFSSERVER and SERVERDIR to match your configuration. NFSSERVER=<hostname> SERVERDIR=/home/ mkdir -p /tmp/mnt/nfs mount -t nfs $NFSSERVER:$SERVERDIR /tmp/mnt/nfs ls /tmp/mnt/nfs umount /tmp/mnt/nfs

Power management

Standby mode wakeup from CPU internal RTC

``` echo +5 > /sys/class/rtc/rtc1/wakealarm && echo standby > /sys/power/state

The device should wake up after 5 seconds

```

Standby mode wakeup from from serial interface

``` echo enabled > /sys/class/tty/ttymxc0/power/wakeup && echo standby > /sys/power/state

Device has to wake up after keypress on the serial console

```

Deep sleep mode wakeup from CPU internal RTC

``` echo +5 > /sys/class/rtc/rtc1/wakealarm && echo mem > /sys/power/state

The device should wake up after 5 seconds

```

Deep sleep mode wakeup from from serial interface

``` echo enabled > /sys/class/tty/ttymxc0/power/wakeup && echo mem > /sys/power/state

Device has to wake up after keypress on the serial console

```

Power management: low power modes (SantVend)

Test Setup


Standby mode wakeup from CPU internal RTC

Test

sh echo +30 > /sys/class/rtc/rtc1/wakealarm && echo standby > /sys/power/state

Expected results

The device should wake up after 5 seconds.

Standby mode wakeup from from serial interface

Test

sh echo enabled > /sys/class/tty/ttymxc0/power/wakeup && echo standby > /sys/power/state

Expected results

Device has to wake up after keypress on the serial console.

Deep sleep mode wakeup from CPU internal RTC

Test

sh echo +30 > /sys/class/rtc/rtc1/wakealarm && echo mem > /sys/power/state

Expected results

The device should wake up after 5 seconds.

Deep sleep mode wakeup from from serial interface

Test

sh echo enabled > /sys/class/tty/ttymxc0/power/wakeup && echo mem > /sys/power/state

Expected results

Device has to wake up after keypress on the serial console.

Power management: poweroff

Test Setup


Reset on short powerfail test

Test

Power up the device. Execute:

sh shutdown -hP 0

Disable the power supply for only ~1 second. The device will be powered by the battery for the short power-outage. Wait for the reset and the system reboot.

Expected results

The system should execute as reboot and be back online after < 1min.

PMIC Off-Mode test

Test

Power up the device. Disable the power supply. The device will then be powered by the battery. Execute:

sh shutdown -hP 0

Wait for device power-down (will be shown on the debug-console). Wait 10 seconds and re-power the power supply. Wait for power-up Execute:

sh reboot

Expected results

After the shutdown command the console should show:

[ xx.xxxxxx] reboot: Power down

The device should power up normally.\ The reboot should work as expected.

Python3

Python3 web certificates

This test ensures that certificates are installed on the system and openssl and python have access them. ``` echo -e "import urllib.request\nprint(urllib.request.urlopen('https://www.google.com'))\n" | python3

Expectet output something like

```

pip3 functionality

This test ensures that python 2 and python 3 on the system are complete enough to allow installation of additional packages via pip. ``` pip3 install virtualenv

Expected output something like: Successfully installed distlib-0.3.6 filelock-3.8.0 platformdirs-2.5.4 virtualenv-20.17.0

```

Qt5

OpenGl ES

```

Preperation

systemctl stop seco-show-demo

qt5-opengles2-test

When you touch the display, a rectancle should show up under the finger

```

Qt Kiosk Browser & Qt Virtual Keyboard

```

Preperation

systemctl stop seco-show-demo

sed -i 's/"URL":.*$/"URL": "https:\/\/north.seco.com\/suchen?",/' /etc/qt-kiosk-browser.conf qt-kiosk-browser /etc/qt-kiosk-browser.conf --no-sandbox

You can verfiy the virtual keyboard functionality by clicking the search field and entering text

```

RS232

RS232 #2

Start a console on the second RS232 interface if present. setsid getty -L 115200 ttymxc1 vt100

RS485

RS485 Full Duplex

Connect two SECO-NE devices using an RS485 full duplex cable. ```

Start echo Server on device #1

/opt/ltp/testcases/bin/rs485echo -n -e -s 115200 -b 64

Send messages from device #2

/opt/ltp/testcases/bin/rs485echo -n -s 115200 -b 64 ```

RS485 Half Duplex

Connect two SECO-NE devices using an RS485 half duplex cable. ```

Start echo Server on device #1

/opt/ltp/testcases/bin/rs485echo -e -s 115200 -b 64

Send messages from device #2

/opt/ltp/testcases/bin/rs485echo -s 115200 -b 64 ```

RTC

RTC write

Disconnect all network interfaces. ```

Set date (02.01.2000) as system time and write it to RTC

date 0102000000 hwclock --systohc

Read system time

date

Read RTC

hwclock

The result should look like: Sat Jan 2 00:00:00 2000 0.000000 seconds

```

sconfig

sconfig read

sconfig

sconfig set value

At the moment sconfig values can not be modified.

SD-Card

SD-Card read and write

Plug in a SD-Card with at least one partition in fat32 format. ``` mount /dev/mmcblk1p1 /mnt/

Verify mount

mount | grep mmcblk1p1

Write

echo "Test data" > /mnt/testfile

Read

cat /mnt/testfile ```

SFTP

The SFTP server is running by default.

SFTP connection

Connect to the device's SFTP server using the sftp command. sftp root@<device-ip>

SSH

The SSH server is running by default.

SSH connection

Connect to the device's SSH server using the ssh command. ssh root@<device-ip>

Temperature Sensors

Temperature read

For on-board sensors like LM75: cat /sys/class/hwmon/hwmon0/temp1_input SOC temperature/s: cat /sys/class/thermal/thermal_zone*/temp

Touch

fingerpaint

```

Preperation

systemctl stop seco-show-demo

fingerpaint ```

fingerpaint rotated by 90 deg

```

Preperation

systemctl stop seco-show-demo

sed -i 's/transform=.*$/transform=rotate-90/g' /etc/xdg/weston/weston.ini systemctl restart weston fingerpaint ```

USB

USB Host read and write

Plug in a USB-Stick with at least one partition in fat32 format. ``` mount /dev/sda1 /mnt/

Verify mount

mount | grep sda1

Write

echo "Test data" > /mnt/testfile

Read

cat /mnt/testfile ```

Serial console on USB OTG port (SANTARO, SANTOKA, SANTINO, SANTINO-LT)

Start a console on the USB OTG port. modprobe g_serial setsid getty -L 115200 ttyGS0 vt100

Video playback

MPEG2 playback

```

Preparation

systemctl stop seco-show-demo

curl http://support.garz-fricke.com/projects/TestFiles/Videos/cc-BigBuckBunny-Trailer-800x448-mpeg2-stereo.mpg > /tmp/video gst-play-1.0 /tmp/video ```

MPEG4 ASP playback

```

Preperation

systemctl stop seco-show-demo

curl http://support.garz-fricke.com/projects/TestFiles/Videos/cc-BigBuckBunny-Trailer-800x448-mpeg4-stereo.mp4 > /tmp/video gst-play-1.0 /tmp/video ```

MPEG4 AVC playback

```

Preperation

systemctl stop seco-show-demo

curl http://support.garz-fricke.com/projects/TestFiles/Videos/cc-BigBuckBunny-Trailer-800x448-h264-stereo.mp4 > /tmp/video gst-play-1.0 /tmp/video ```

VP9 playback from qml

```

Preperation

systemctl stop seco-show-demo

qmlscene /opt/ltp/scripts/video_playback.qml ```

Watchdog

Watchdog test

/opt/ltp/testcases/bin/watchdog-test

WiFi

Scan wireless networks (nmcli)

nmcli dev wifi list

Connect to wireles network (nmcli)

nmcli dev wifi connect <ssid> password "<password>"