Embedded development

DISCLAIMER OF LIABILITY

THE PROCEDURES AND SAMPLES IN THIS PAGE ARE PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND (EITHER EXPRESS OR IMPLIED), INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A SPECIFIC OR GENERAL PURPOSE AND THOSE ARISING BY STATUTE OR BY LAW, OR FROM A CAUSE OF DEALING OR USAGE OF TRADE.

THIS ALSO APPLIES TO THE CONSEQUENCES OF ANY ACTIONS TAKEN ON THE BASIS OF THE INFORMATION PROVIDED. 

Introduction

AdvanReader 160/150 Series and AdvanReader 70/60 Series feature an embedded Linux board that is open for everyone to develop applications.

This page describes procedures and examples of embedded developments.

Please request root password to support@keonn.com

Warranty implications

Embedded development requires root access to the system, root user may potentially damage the system and put it into an unusable state.

Please note that:

ANY SOFTWARE FOUND IN THE EMBEDDED LINUX BOARD IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

IN NO EVENT SHALL KEONN TECHNOLOGES SL OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH ANY SOFTWARE DEVELOPED IN THE EMBEDDED LINUX BOARD OR THE USE OR OTHER DEALINGS IN SUCH SOFTWARE.

Connecting to the Device

Discover Device

To discover the device IP address, look into our wiki: Discover Devices. Once the device IP address is found, connect to the device.

Connect to the Device

Contact our Support Team to get the credentials to connect to the Device

Connect to the Device by SSH:

ssh keonn@<ip-address> (for example ssh keonn@192.168.1.119)

Change password

The supplied password can be changed with the passwd commands.

1. Use putty or any SSH client to log in as keonn user, and the upplied password.

2. Use the passwd command as follows

Embedded Java development

See embedded Java development page

Embedded C/C++ development

See embedded C/C++ development page

Embedded AdvanNet

See embedded AdvanNet development page

Local NTP server

See Local NTP Server page

Other configuration

Network settings

It is possible to manually change the network settings.

Changing the network settings may result in a non-accessible device, please make sure to follow the guidelines as exactly stated. 

In case of the device becoming inaccessible, follow instruction from the recovery chapter.

Use DHCP

Follow the steps:

auto lo

iface lo inet loopback

# The primary network interface

allow-hotplug eth0

iface eth0 inet dhcp

auto eth0:1

allow-hotplug eth0:1

iface eth0:1 inet static

    address 172.31.61.2

    netmask 255.255.255.0

# Ethernet/RNDIS gadget (g_ether)

# ... or on host side, usbnet and random hwaddr

# Note on some boards, usb0 is automaticly setup with an init script

allow-hotplug usb0

iface usb0 inet static

    address 192.168.7.2

    netmask 255.255.255.0

    network 192.168.7.0

$sudo /etc/init.d/networking restart

Make sure a DHCP server is enabled in the network, otherwise the device won't be available.

Use static IP address

Follow the steps:

auto lo

iface lo inet loopback

# The primary network interface

allow-hotplug eth0

iface eth0 inet static

    address ${address}

    netmask ${netmask}

    gateway ${gateway}

auto eth0:1

allow-hotplug eth0:1

iface eth0:1 inet static

    address 172.31.61.2

    netmask 255.255.255.0

allow-hotplug usb0

iface usb0 inet static

    address 192.168.7.2

    netmask 255.255.255.0

    network 192.168.7.0

Change ${address}, ${netmask} and ${gateway} by the real values. For example:

auto lo

iface lo inet loopback

# The primary network interface

allow-hotplug eth0

iface eth0 inet static

    address 192.168.1.23

    netmask 255.255.255.0

    gateway 192.168.1.1

auto eth0:1

allow-hotplug eth0:1

iface eth0:1 inet static

    address 172.31.61.2

    netmask 255.255.255.0

allow-hotplug usb0

iface usb0 inet static

    address 192.168.7.2

    netmask 255.255.255.0

    network 192.168.7.0

nameserver 8.8.8.8

nameserver 8.8.4.4

It is also possible to use other DNS servers.

$sudo /etc/init.d/networking restart

3rd party software install

It is possible to install 3rd party software. Please remember:

There are two approaches when installing 3rd party software. Both of them require Internet access from within the device.

Standard Debian repository software

The preferred way for package management is apt application.

A comprehensive introduction can be found at https://wiki.debian.org/AptCLI

Available packages can be queried at https://www.debian.org/distrib/packages

The following capture shows the required parameters to search for lighttpd package (https://www.lighttpd.net/).

Quick guide

Make sure the device can access Internet.

Before attempting any installation, always make sure your indexes are updated

keonn@AdvanReader-m4-150#sudo apt-get update

install lighttpd server

keonn@AdvanReader-m4-150#sudo apt-get install lighttpd

Non-repository software

Make sure the device can access Internet.

In this case you must follow the software developer install instructions. In case the software install is done from source code, make sure the basic build infrastructure is available.

# update the repository indexes

keonn@AdvanReader-m4-150#sudo apt-get update

# install the basic build infrastructure

keonn@AdvanReader-m4-150#sudo apt-get install build-essential

Only install build-essential package in case it is required.

Installing build-essential will download and install lots of packages

Command line samples

IO operation

By default AdvanNet takes care of all IO initialization and proper handling. However, it is possible to control the IO lines from the Linux command line.

This chapter applies only to people not using AdvanNet and handling IO operations using Linux commands.

Handling IO operations as described in this chapter may not be the most efficient way. This method is best suited for demo purposes only.

IO lines are not isolated, please make sure to avoid potentially harmful conditions:

What follows are the tables of the GPIO lines for all AdvanReader 150 Series models

AdvanReader-150 revision 02. IO table

1 (inverted) means when applying '0' the output will be set to '1'.

2 Buzzer is driven like any other GPO line.

The 02 revision can be ordered with an alternative GPIO connector. The auxiliary GPIO connector provides access to the following GPIO lines

1 The uart Tx line need a pull-up resistor, it can be connected either to 5 V or 3.3 V.

AdvanReader-150 revision 03. IO table

1 (inverted) means when applying '0' the output will be set to '1'.

2 Buzzer is driven like any other GPO line.

AdvanReader-60 revision 03. IO table

AdvanReader-70 IO table

1 (inverted) means when applying '0' the output will be set to '1'.

2 Buzzer is driven like any other GPO line.

AdvanReader-150 revision 04. / AdvanReader-160 IO table

1 (inverted) means when applying '0' the output will be set to '1'.

2 Buzzer is driven like any other GPO line.

IO setup

Some steps are required to initialize the IO sub-system. Execute all commands as root.

root@AdvanReader-m4-150#cd /sys/class/gpio

root@AdvanReader-m4-150#echo 50 > export

root@AdvanReader-m4-150#echo out > /sys/class/gpio/gpio50/direction (For an output line)

root@AdvanReader-m4-150#echo in > /sys/class/gpio/gpio48/direction (For an input line)

In case the IO lines where already exported an error will be received when exporting: 

echo: write error: Invalid argument

In debian 10, exporting an already exported line will unexport the line.

Change GPO value

root@AdvanReader-m4-150#echo 0 > /sys/class/gpio/gpio50/value
root@AdvanReader-m4-150#echo 1 > /sys/class/gpio/gpio50/value

Check GPI value

root@AdvanReader-m4-150#cat /sys/class/gpio/gpio48/value

Other

Access reader images from Windows

It is possible to verify an SD card is contains a valid file system by using a Windows utility: http://www.diskinternals.com/linux-reader/

Troubleshooting

AdvanNet thread dump

Starting at 2.5.6_18 AdvanNet adds its thread dump on the logs everytime they're exported

It is possible to access the run-time threads of AdvanNet instance.

When connected by SSH, do the following:

1. Identify AdvanNet PID

root@AdvanSafe-100-eu:~# ps ax | grep java

Write down the number in the red circle

2. Force the thread dump

root@AdvanSafe-100-eu:~# kill -3 398

Change 398 by your PID

3. Copy log file 

Once the kill -3 has been executed, the thread dump is in file /var/log/AdvanNet-kernel.log

use scp, FileZilla or your preferred SSH cline to retrieve that file