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:
Keonn Technologies S.L does not directly support any embedded development, other that the guidelines stated in this website.
Keonn Technologies S.L. provides working images of the SW to restore the system to factory defaults.
Warranty on system software operation is automatically broken once the root password is supplied. In particular, any embedded development is subjected to the following disclaimers.
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:
Linux: Open a terminal and use the following command:
ssh keonn@<ip-address> (for example ssh keonn@192.168.1.119)
Windows:
Download PuTTy: http://www.putty.org/
Connect to the device:
Write the User provided by our Support Team:
Write the password provided by our Support Team (the password will not be shown while writing it):
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:
Make sure the file /etc/network/interfaces looks like:
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
Restart networking:
$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:
Make sure the file /etc/network/interfaces looks like:
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
Change /etc/resolve.conf file to
nameserver 8.8.8.8
nameserver 8.8.4.4
It is also possible to use other DNS servers.
Restart networking:
$sudo /etc/init.d/networking restart
3rd party software install
It is possible to install 3rd party software. Please remember:
Keonn will not provide support on the installation of 3rd party software. This includes:
Support before/during/after the installation
Support for any side-effect of the 3rd party software installed.
It is the user responsibility to make sure the software installed does not interfere with the existing software in the device.
It is the user responsibility to make sure the software installed does compromise the operation of the device.
Always install lightweight versions of the required functionality.
The system must be tested under maximum load and verify all parts perform as expected.
Read again this initial chapter.
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
Update the repository indexes
keonn@AdvanReader-m4-150#sudo apt-get update
Now it's safe to attempt the package install
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:
Avoid ESD problems by following the standard procedures regarding ESD.
Verify maximum allowed ratings.
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.
5 V: it can be connected to auxiliary IO connector pin #1
3.3 V: an external power supply of 5 V is required. An LDO can be connected to auxiliary IO connector pin #1 (5 V)
A resistor of 560 ohm should allow a baudrate of 912600
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.
If exists: make sure the script /home/keonn/bin/generate_capes.sh has been executed.
Export the IO lines: for any GPIO line in used it is required to export it
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