Edge Computer EC300 Series
User Manual
(Applicable for IEOS V2.0.0 and above)
Version1.1, February 2024
Copyright Notice
© 2024 InHand Networks.All rights reserved.
The InHand logo is a registered trademark of InHand Networks.
InHand Networks reserves the right to change this manual, and the product is subject to subsequent changes without prior notice. We will not be responsible for any direct, indirect, intentional, or unintentional damages and hidden dangers caused by improper installation and use.
This user's manual is for the Arm architecture based edge computer EC300 and covers a complete set of instructions for all supported models. Before referring to these chapters, verify that the hardware specifications of your computer model support the features covered.
In this chapter, we will cover the external interface instructions of EC300, an edge computer based on Arm architecture.
The following sections describe the application of external connectors and pin assignment.
This is a dual RJ45 connector for Ethernet connection
The EC300 has 2 RJ45 Ethernet ports and supports 10M/100M adaptive rates.
Yellow light: LINK indicator light, the end device is on when the interface is 1000M, and the end device is off when the interface is 10/100M.
Green light: ACT light, flashing when there is data
EC300 supports up to four serial ports: two standard serial ports and two expandable serial ports.
COM1(standard): RS-232 / RS-485 (RX1 TX1 / A1 B1),you can only choose to access RS-232 or RS-485 at the same time, they can't work at the same time.
COM2(standard): RS-485 (A2 B2)
COM3(extensible): RS232 / RS485 (Extended interface PIN1 Extended interface PIN2)
COM4(extensible): RS232 / RS485 (Extended interface PIN5 Extended interface PIN6)
The EC300 optionally supports the expansion of up to 3 CAN bus interfaces, compatible with CAN 2.0A/B standard and CAN FD, with a maximum speed of 5Mbps.
CAN1: Extended interface PIN1 Extended interface PIN2
CAN2: Extend interface PIN5 Extend interface PIN6
CAN3: Expand interface PIN9 Expand interface PIN10
Parameter | Description | Min | Type | Max | Unit |
Vds | Drain source voltage | 48 | V | ||
VIN Low | Maximal input voltage recongnized as LOW | 3 | V | ||
VIN High | Minimal input voltage recognized as HIGH | 10 | 30 | V |
The EC300 provides a USB 2.0 Host port.
EC300 has 8 LED lights to indicate the power supply and system operation status respectively.
ARM computers provide programmable buttons, which are provided to users for development and use using the event event process. The event corresponding to the button is /dev/input/event0.
The EC300 supports 9 to 48V DC input
The EC300 supports 2 SIM card slots, and the SIM card needs to be installed with power off by pressing the SIM card into the slot.
The EC300 has a slot for the MircoSD card, SD does not support hotplugging and needs to be plugged in and out with power off.
There is a reset button for the system to restore the factory. Refer to The system restores factory Settings to do so.
There are 5 antenna interfaces in EC300, and the number of antennas standard with different models is different. Screw the antenna into the corresponding antenna interface to complete the antenna installation.
Extension module | Feature |
NAAD | 2x 4-20mA analog
input+4x DI+4x DO |
N44C | 2x RS-485+1x CAN FD |
N4CC | 1x RS-485+2x CAN FD |
N44D | 2x RS-485+4x DI+4x DO |
— | NONE |
PIN |
Extension module&Interface Definition |
|||
NAAD |
N44C |
N4CC |
N44D |
|
1 |
AIN1+ |
A_485_A |
A_485_A |
A_485_A |
2 |
- |
A_485_B |
A_485_B |
A_485_B |
3 |
AIN1- |
- |
- |
- |
4 |
GND |
GND |
GND |
GND |
5 |
AIN2+ |
B_485_A |
CAN2_H |
B_485_A |
6 |
- |
B_485_B |
CAN2_L |
B_485_B |
7 |
AIN2- |
- |
- |
- |
8 |
GND |
GND |
GND |
GND |
9 |
- |
CAN3_H |
CAN3_H |
- |
10 |
- |
CAN3_L |
CAN3_L |
- |
11 |
DO0 |
- |
- |
DO0 |
12 |
DO1 |
- |
- |
DO1 |
13 |
DO2 |
- |
- |
DO2 |
14 |
DO3 |
- |
- |
DO3 |
15 |
DI0 |
- |
- |
DI0 |
16 |
DI1 |
- |
- |
DI1 |
17 |
DI2 |
- |
- |
DI2 |
18 |
DI3 |
- |
- |
DI3 |
19 |
DI_COM |
- |
- |
DI_COM |
20 |
GND |
- |
- |
GND |
In this chapter, we will cover the basic configuration of EC300, an edge computer based on Arm architecture.
You will need a computer that you can use to connect to the EC300 and log in to the command line interface. It can be connected by means of an Ethernet cable.
Factory default username and password:
Username: edge
Password: security@edge
EC300 devices are factory created root by default, but login is disabled. If you need to use the root user, change the system configuration manually and type sudo -s to switch to the root user. The user edge is in the sudo group, so you can use sudo under the edge user to execute system-level commands. See the sudo Mechanism section in Chapter 5 for additional details.
Tips:
When command not found appears, type sudo -s to switch to the root user or use the sudo command to operate.
Note:
For security reasons, we recommend that you disable the default user account and create your own.
The EC300 supports SSH connections over Ethernet. Connect to the EC300 using the following default IP address.
Tips
These steps apply if you are connecting to EC300 on a Linux PC. Please do not apply these steps to the EC300 device itself. Before you run the ssh command, be sure to configure your PC's Ethernet port IP address to be within a specific range. ETH1:192.168.3.0/24, ETH2:192.168.4.0/24.
Use the ssh command to access the ETH1 port of the EC300 on a Linux PC.
Type yes to continue to complete the connection.
When the terminal prompt edge@edge-computer:~$appears and shell commands can be entered, the connection is successful.
Tips:
These steps apply if you are connecting the EC300 on a Windows PC. Please do not apply these steps to the EC300 device itself.
Make the following steps on your Windows PC
Click the link http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html, download PuTTY (free) software, SSH command in Windows environment to establish a connection to the edge computer EC300. The following is an example of using SSH to connect:
You can use the sudo -s command to switch to the root user. For security reasons, do not operate all commands as root.
Tips:
Click on the link for more information on sudo commands.
Pay attention to:
You may get a "permission denied" message when using some pipe or redirect behavior without root permissions. In this case, you must use 'sudo su -c' instead of '>','<','>>','<<','etc', etc. You need to include the full command in single quotes.
You can use the useradd and userdel commands to create and delete a user's account. Be sure to use these commands in the home screen to set the relevant access rights for that account. Here is an example of how to create test1 in the sudo group (the default login environment for test1 users is bash and their home directory is /home/test1)
To change test1's password, use the passwd command, enter the new password and repeat to confirm the change
If you want to remove user test1, use the command userdel
Note
You should first create a user account before disabling the default account
Use the passwd command to lock the default user account so that edge users cannot log in
Unlock the edge user
IEOS is a set of network management and system management program running on Linux system developed by InHand. IEOS provides web interface, users can access Ethernet port ip address, cellular dial-up, Wi-Fi Station, DHCP Client/Server, static routing, and network management through the web. Firewalls and other network configuration; System time, time zone, firmware upgrade and system restart can also be operated; In addition, IEOS also supports docking with InHand device management platform DeviceLive. Users can remotely monitor and manage EC300 devices through DeviceLive platform.
IEOS adopts the design scheme of status and configuration separation, which is divided into three functional sections: network management, system management and status. The network management menu and the system management menu can only be used for network and system related configuration, and the status information needs to be unified to the status page.
Important note: When using IEOS program to manage network configuration and system configuration, if you use Linux native commands at the same time, the two may affect each other, resulting in abnormal running state. It is recommended that the configuration supported by IEOS be managed through IEOS web, and the configuration not supported by IEOS, such as VPN, can be combined with native Linux commands to achieve the configuration goal.
Login Address:https://192.168.4.100:9100
login account: adm
login password: 123456
Important note: When IEOS program is enabled, it will reserve some port numbers for internal communication. The reserved port number ranges from 9100 to 9200. After IEOS is enabled, the client's program should avoid using these port numbers, otherwise it may cause conflicts and malfunction.
Configure the eth1 interface with a static IP address
Configure the eth1 interface with a DHCP Client
Start the dhcp server function on the eth1 interface and assign an address to the eth1 unhooked device
DHCP Server configuration parameters description:
Enable DHCP Server: The switch of DHCP Server function
Starting Address: Starting base address of DHCP Server address pool, network segment + starting address = starting ip address of address pool. In the screenshot, the network segment of eth1 is 192.168.3.0/24, and the base address is 1, then the starting address of the address pool is 192.168.3.1/24.
Max Address Number: The maximum number of addresses in the address pool.
Lease period: The length of the lease period
Cellular network parameters Description:
Enabled: The switch of cellular function; Enabled by default.
Profiles: A set of dial parameters used to configure APN, username, password, and authentication methods when dialing a dedicated network card. If you are not a dedicated network card, you usually do not need to change the configuration here. You can add up to 10 records to the dial-up parameter set.
Network Mode: The network mode of the cell, you can choose 3G, 4G and other related network mode, such as LTE, WCDMA, etc. If it is not clear which network mode to choose, select automatic; The program will automatically select the most appropriate network mode. The default is automatic.
Enable Default Route: Enable the add default route function, when enabled, when the dial is successful, it will add a default route of the cellular port. The default route is enabled.
Metric: This is the metric for the default routing of the cellular port. When default routing is configured on the cellular, Wi-Fi, and Ethernet ports, the metric with the lowest value is used.
Dual SIM Enabled: Dual Sim enabled. In order to improve the reliability of the network, EC300 supports dual SIM and single dial. Two sim cards need to be inserted into the device. If the sim1 card fails to dial because of unpaid charges, it will automatically switch to the sim2 card for dialing. By default, it is off.
Main SIM: The main sim card, when dialing, the selected sim card will be preferred for dialing. When dialing fails to reach a certain number of times, when switching to another sim card for dialing, the default is to use sim1 for dialing.
Max Number of Dials: When the dual-SIM single-dial function is enabled, the current sim card will be dialed to another sim card for dialing when the number of dials reaches a specified number.
APN Profile: sim card selected dialing parameters set, the default value is automatic. Usually special network card usually need to configure the dial parameter set, and select the Index of the dial parameter set here.
PIN Code: The PIN code of the sim card.
Wireless cellular networks are complex, sometimes there will be dial-up false connection, that is, the dial-up state is successful, but the target address can not be ping; When this happens, you can simply dial again and get back to normal. IEOS cellular dialing supports ICMP probing to detect spurious connections. It is recommended that customers with cellular connections enable ICMP probing so that false connections can be quickly recovered.
ICMP probe parameters:
ICMP Detection Server Probes: ICMP probe address; 2 probe addresses can be configured, as long as 1 address is successfully probed, it means that there is no fake connection in the cell. When neither address is configured, ICMP probing is turned off.
Detection Interval: How often should ICMP probes be performed?
Detection Timeout: The duration of ICMP probe timeout. If no probe response packet is received, the probe is considered to have failed
Detection Max Retries: the maximum number of probes; When a probe fails to reach this value, a redial is triggered. Range [1,5]
Detection Strict: Whether strict detection is enabled. When strict detection is turned off, the detection program will detect whether the packet received by the cellular interface has changed in each detection cycle. If there is a change, it means that the cellular network is working, and ICMP packets will not be sent for detection, so as to save some traffic; If the probe is turned on, ICMP probe packets will be sent periodically regardless of whether the number of packets received by the cellular interface has changed. By default, it is off.
In Advanced configuration are some less commonly used Settings options.
Debug Mode enabled: Whether the debug function is enabled. After enabled, some dial-related debugging information will be added to the log, and it is disabled by default.
Enable Infinitely Redial: In some cases, dialing will be in an abnormal state, which can be restored by rebooting the system; By default infinite redialing is turned off, and the system will be restarted to try to recover after a certain number of dialing failures. Since dialing is enabled by default, some customers without sim card, dialing failure, the system will restart, in this case, you can open unlimited redialing; In this way, no matter how many times the dialing fails, the system will not restart.
Dial Interval; But if a dial fails, the amount of time to wait before making another dial.
Signal Query Interval: Signal query interval. When the signal is bad, you may have problems with false connections; At this time, redialing has a certain probability to solve the problem of false connection. The dialing program will check the signal strength at regular intervals; here, the signal detection period is configured.
Enable Wi-Fi: Enable the switch; Off by default
Client SSID: The ssid you want to connect to, you can enter it manually; You can also use the scan button to get nearby SSIDs that you can connect to
Enable Default Route: Enable the function of adding default route. If enabled, when the wifi connection is successful, a default route of wlan port will be added. The default route is enabled.
Metric: This is the metric for the default route of the wifi port. When the default route is configured for the cellular, Wi-Fi, and Ethernet ports, the metric with the lowest value is applied.
Auth Method: Auth method, supports no auth, WPA-PSK, WPA2-PSK, WPA-PSK/WPA2-PSK Mixed
Encrypt Mode:CCMP, TKIP, TKIP and CCMP are supported
WPA/WPA2 PSK Key: Key information
This is a static routing for Ethernet. When the default routing for Ethernet, cellular, and wifi is configured, the default route with the lowest metric value will take effect. You need to make sure that the Metric value of the default route is different.
Static route configuration parameters:
Interface: The outgoing interface of the static route
Target: The target network
Netmask: Target network mask
Gateway: Next hop address
Metric: The metric for the static route
Only the iptables command is currently supported for configuration.
DNS Servers: DNS Server address, up to 4 can be configured
Domain name hijacking: Domain name hijacking function, can realize the binding between IP address and domain name.
Network diagnostics support ping, traceroute and nslookup functions.
Cloud management
Enabled: the enable switch that connects to the DeviceLive platform; DeviceLive is the remote monitoring and management platform of Inhantong equipment;
Cloud Server: DeviceLive platform has 2 addresses; One is the address of the domestic platform, the other is the address of the overseas platform; Here you choose which platform to connect to.
Time zone and NTP client
A maximum of 10 NTP Server addresses can be configured, and the program periodically sends synchronization requests to each server address in turn. After the synchronization is successful, the system time is written to the RTC and no longer continues to send synchronization requests to the later NTP servers.
In addition to using NTP to synchronize the time, there is a synchronization button in the Device Info status page to synchronize the time manually, but only when the device time and the local time (the time of accessing the computer used by the device) differ by more than 3s, this synchronization button will be displayed.
Configuration import, export and factory restore are supported here.
The automatic restart option is turned off by default. After upgrading the firmware, you need to manually restart the system to take effect; When the automatic restart option is enabled, the system will be restarted automatically after the firmware upgrade is successful.
This page has 2 functions: restart the system and reset the system. Resetting the system needs to be used carefully. The resetting system function will restore the system configuration status and file system status to the factory, which means that the software installed by the user will also be cleared.
The device information status page shows hostname, device model, serial number, firmware version, kernel version, filesystem version, and an overview of CPU, memory, and disk space usage.
The cellular dial status page shows the sim card, IMIE, IMSI, ICCID, signal strength used by the current dial, as well as the IP address, DNS and other information obtained by the dial.
The Wi-Fi status page shows the IP address, gateway, and DNS information obtained after the Wi-Fi connection was successful.
The DHCP Server status page shows the assigned IP address of the device as a DHCP Server, the client hostname, the client host mac, and the expiration time.
The route status page displays IPv4 direct route, static route and route neighbor information.
Firewall status information shows filtering rules, IP address mapping rules and other information.
The log page can view the system log, user log and set the log level, including Error, Info, Debug and other levels. Logs can also be downloaded locally.
When using the Linux command line for network and system configuration, the first thing you need to do is close the IEOS program. IEOS is managed through systemctl,
Shutting down IEOS is done as follows:
systemctl stop ieos_daemon
This shutdown only applies to this startup, and IEOS programs will still start after the system is rebooted. Here's how to prevent IEOS programs from starting:
systemctl disable ieos_daemon
Important note: After IEOS is turned off, wireless networking functions such as dialing and Wi-Fi require native Linux commands, and there is no way to remotely manage devices on the DeviceLive platform.
If you want to set static IP address for EC300, through the command vim/etc/network/interfaces. D/eth1 or vim/etc/network/interfaces. D/for eth2 modify the corresponding network configuration file to the default gateway for Ethernet interface, address, Network and subnet mask. As an example, let's set a static IP address for the eth2 port:
After changing the interface IP configuration, run /etc/init.d/networking restart to restart the network service for the configuration to take effect.
If you want to set dynamic IP address for EC300, through the command vim/etc/network/interfaces. D/eth1 or vim/etc/network/interfaces. D/for eth2 modify the corresponding network configuration file, Setting it to DHCP after inet will automatically get the IP address.
Here is an example of setting a dynamic IP to the eth1 port.
After changing the interface IP configuration, run /etc/init.d/networking restart to restart the network service for the configuration to take effect.
To check the computer firmware version for the EC300, type:
To determine the amount of available drive space, use the df command with the -h option. The system will return the amount of drive space broken down by file system. For EC300 products, the disk partition available to users is /dev/mmcblk0p8. Here's an example:
The EC300 has two time Settings. One is system time and the other is RTC (Real Time Clock) time, which is maintained by the EC300's hardware. Use the date command to query the current system time or to set a new system time. Use the hwclock command to query the current RTC time or set a new RTC time.
Set the system time with the command date MMDDhhmmYYYY:
MM: month
DD: day
hh: hour
mm: minutes
YYYY: Year
RTC time can be set to system time using the following command
Click on the link below for more details about the date and time:
https://www.debian.org/doc/manuals/system-administrator/ch-sysadmin-time.html
https://wiki.debian.org/DateTime
There are two ways to configure the time zone for the EC300. One is to use the command tzselect. The other is to use the /etc/localtime file.
When you type the tzselect command, you will be taken to the area selection screen. Select the approximate area (divided by continent and ocean) and enter the number in front of the continent or ocean
Then select the continent or the country under the ocean
Follow the steps above to get the China time zone keyword Asia/Shanghai and execute the following command to set the time zone
The localtime file is stored in /etc/localtime, which is used by the GNU libraries for C (glibc) if no value has been set for the TZ environment variable. localtime files are either copies of /usr/share/zoneinfo/file or symbolic links to /usr/share/ zoneinfo/file. If the EC300 cannot find the /usr/share/zoneinfo/ file, you can download the required time zone information file from this site https://www.iana.org/time-zones and relink it to the localtime file in the EC300.
Note:
After successfully downloading the required time zone information file, unzip it, and then compile and generate the corresponding binary file using zic command. The generated time zone file is "/usr/share/zoneinfo/custom time zone filename".
In this chapter, we will introduce the advanced configuration of peripheral interfaces for EC300, an edge computer based on Arm architecture.
This chapter covers the following topics:
EC300 has four serial ports, one serial port supports RS485, three serial ports support RS-232 or RS-485 mode.
The corresponding device node for COM1 is /dev/ttyS4
The device node for COM2 is /dev/ttyS5
The device node for COM3 is /dev/ttyS6
COM4 is represented by /dev/ttyS8
View and set the serial port with the stty command
To see the details, type sudo stty --help:
Note
Details about the stty command are available at the following link
http://www.gnu.org/software/coreutils/manual/coreutils.html
The EC300 provides a USB 2.0 Host interface, which is mainly used to expand storage devices
The EC300 supports USB storage device hotplugging.
Note
Remember to enter the sync sync command before disconnecting your USB mass storage device to prevent data loss. When you disconnect the storage device, exit from the mount directory.
The EC300 supports micro SD memory cards without hotplugging. Mount the reference https://www.man7.org/linux/man-pages/man8/mount.8.html
The three-way CAN port of the EC300 supports the CAN bus.
By default, the CAN port will be initialized. If you need any other configuration, check the CAN device using the ip link command. To check the status of the CAN device, use the ip link command:
To configure a CAN device, use ip link set can* down to first turn off the device
Where can* down is selected from can1, can2, or can3.
Then configure the bit rate (here's a 50k bit rate example) :
Finally turn the device back on
The EC300 supports 4-way IO input and 4-way IO output.
Reading the DI status can be done using cat "Device profile";
DO status can be controlled by using echo 1 > "Device Profile" or echo 0 > "Device Profile" as root user
Port number |
Device description file |
AIN1 |
/dev/ain1 |
AIN2 |
/dev/ain2 |
The cat
"device profile" can be used to read AIN current values.
The specifications of the super-capacitor are: 10.8V/5F.
The power-down retention module can maintain system operation for 20-30 seconds after power failure, depending on the load.
The EC300 supports the power-down alarm function. When the external power supply is disconnected, the system will send a UDP broadcast message ‘power_down’ to port 9107 of IP address 255.255.255.255.
Power failure refers to the continuous disconnection of the external power supply for more than 0.5 seconds. After sending the UDP broadcast message, the system waits for 3 seconds and actively performs a poweroff.
In this chapter, we will introduce the security mechanism of EC300, an edge computer based on ARM architecture.
In EC300, the root user is banned for better security. Sudo is a program that lets the system administrator allow an approved user to execute some commands as the root user or another user. The most basic rule is to give as few privileges as possible to get the job done. Using sudo is more secure than root session opening for a number of reasons, including:
• Grant privileges to normal users without having to know the root password (sudo will prompt for the current user's password)
• It's easy to run privileged commands via sudo, and the rest of the time, work as an unprivileged user, reducing potential damage due to wrong operations.
Netfileter/iptables is an excellent and free firewall tool based on packet filtering which comes with nuix/linux system. It is very powerful and flexible, and can control the data packets flowing in, out and through the server in fine detail.
TPM stands for "Trusted Platform Module" and it is a hardware security module designed to provide security and encryption capabilities for computer systems. It is a secure microcontroller that can be embedded in a computer system or sold as a standalone hardware device. It contains a cryptographic coprocessor for storing encryption keys, digital certificates, and other secure data, as well as supporting multiple cryptographic algorithms and security protocols. On EC300, the standard TPM2 protocol stack and TPM2 tools have been integrated for user use.
Generate random numbers
NOTE
For more information on how to use tpm2-tools, please refer to https://tpm2-tools.readthedocs.io/en/latest/
In this chapter, we will describe how EC300, an edge computer based on Arm architecture, restores factory Settings .
This chapter covers the following topics:
There are two ways to restore factory Settings:
EC300 provides a JSON format device information description file. Customers who need to operate IO, LED, serial port and other peripherals can obtain the device node information of these peripherals by querying the device description information file.
Device description file path: /tmp/ieos/etc/system_info.json, the content is as follows:
{
"device_info": {
"model_info": {
"model": "EC312",
"pn": "H-LQA3-LC4D",
"sn": "CL3124050000001",
"oem": "inhand",
"features": ";std;cell-LQA3;wlan;"
},
"software_info": {
"boot_loader": "V1.0.2",
"kernel": "5.10.168",
"version": "V1.0.1-beta1",
"os": "Debian GNU/Linux 11 (bullseye)"
},
"hardware_info": {
"arch": "armv8",
"soc": "AM6231",
"interface": {
"eth": [
{
"iface_name": "eth1",
"iface_mac": "00:08:5f:17:04:00"
},
{
"iface_name": "eth2",
"iface_mac": "00:18:5f:17:04:02"
}
],
"wlan": [
{
"iface_name": "wlan0",
"iface_mac": "f4:3c:3b:ca:e9:36"
},
{
"iface_name": "wlan1",
"iface_mac": "f6:3c:3b:ca:e9:36"
}
]
},
"gpio": [
{
"gpio_name": "cellular_power",
"dev_node": "/sys/class/gpio/gpio401"
},
{
"gpio_name": "sim_switch",
"dev_node": "/sys/class/gpio/gpio405"
}
],
"user_key": [
{
"user_key_name": "user1",
"dev_node": "/dev/input/event2"
}
],
"uart": [
{
"uart_name": "com1",
"dev_node": "/dev/ttyS4"
},
{
"uart_name": "com2",
"dev_node": "/dev/ttyS5"
}
],
"led": [
{
"led_name": "user1",
"dev_node": "/sys/class/leds/user1"
},
{
"led_name": "user2",
"dev_node": "/sys/class/leds/user2"
},
{
"led_name": "user3",
"dev_node": "/sys/class/leds/user3"
},
{
"led_name": "user4",
"dev_node": "/sys/class/leds/user4"
},
{
"led_name": "cell",
"dev_node": "/sys/class/leds/cell"
},
{
"led_name": "warn",
"dev_node": "/sys/class/leds/warn"
},
{
"led_name": "status",
"dev_node": "/sys/class/leds/status"
}
],
"io": {
"di": [
{
"di_name": "di1",
"dev_node": "/sys/class/gpio/gpio454"
},
{
"di_name": "di2",
"dev_node": "/sys/class/gpio/gpio455"
},
{
"di_name": "di3",
"dev_node": "/sys/class/gpio/gpio456"
},
{
"di_name": "di4",
"dev_node": "/sys/class/gpio/gpio457"
}
],
"do": [
{
"do_name":"do1", //The name matches the name on the panel
"dev_node": "/sys/class/gpio/gpio11"
},
{
"do_name":"do2",
"dev_node":"/sys/class/gpio/gpio12"
}
]
},
"ain": [
{
"ain_name": "ain1",
"ain_node": "/dev/ain1"
},
{
"ain_name": "ain2",
"ain_node": "/dev/ain2"
}
]
}
}
}
Currently, there are a total of 8 IO interfaces on the device: for example, there are 4 input pins from DI1 to DI4 on the device panel; DO1~DO4 are 4 output pins.
According to the device description file /tmp/ieos/etc/system_info.json, the IO device nodes are:
When you need to programming IO interface, direct manipulation background device nodes below the value value (sys/class/gpio/gpioxxx/value)
Case study:
When DO1 need to output high electricity at ordinary times, can be directly to sys/class/write 1 gpio/gpio323 / value
echo 1 > /sys/class/gpio/gpio323/value
When you need to check the DI1 level is, the same can be directly to check the sys/class/gpio gpio454 / the value of the value
cat /sys/class/gpio/gpio454/value
The full shell script:
#!/bin/bash gpio323="/sys/class/gpio/gpio323/value" gpio453="/sys/class/gpio/gpio453/value" gpio465="/sys/class/gpio/gpio465/value" gpio461="/sys/class/gpio/gpio461/value" # When DO1 need to output high electricity at ordinary times, can be directly to sys/class/write 1 gpio/gpio323 / value if [ -f "$gpio323" ]; then echo 1 > /sys/class/gpio/gpio323/value else echo "no file exit "$gpio323 fi # When DO1 need output low electricity at ordinary times, can be directly to sys/class/write 1 gpio/gpio323 / value if [ -f "$gpio323" ]; then echo 0 > $gpio323 else echo "no file exit "$gpio323 fi gpio454="/sys/class/gpio/gpio454/value" gpio455="/sys/class/gpio/gpio455/value" gpio456="/sys/class/gpio/gpio456/value" gpio457="/sys/class/gpio/gpio457/value" # When you need to check the DI1 level is, the same can be directly to check the sys/class/gpio gpio454 / the value of the value if [ -f "$gpio454" ]; then cat $gpio454 else echo "no file exit "$gpio454 fi
The user can use the four lights USER1, USER2, USER3 and USER4 on the device for status prompts, please check the light label to confirm the position of the light.
According to the device description information file /tmp/ieos/etc/system_info.json, the device node corresponding to LED can be obtained as follows:
user1: /sys/class/leds/user1
user2: /sys/class/leds/user2
user3: /sys/class/leds/user3
user4: /sys/class/leds/user4
There are some control files in /sys/class/leds/user1 to control the attributes and status of leds:
/ sys/class/leds/user1 / brightness: this file is used to control the user1 lights on or off. Write 1 to always on, write 0 to always off.
/ sys/class/leds/user1 / trigger: leds trigger, can write the timer timer trigger, write none said cancel the trigger.
/ sys/class/leds/user1 / delay_on: it is time to file said led lights, is an unit with ms.
/ sys/class/leds/user1 / delay_off: it is time to file said led lights, is an unit with ms.
If trigger is configured for timing, the value in the brightness will no longer take effect and will automatically change to 0.
Replace user1 with user2 in the file path to control the operation of the USER2 light, and the same for USER3 and USER4.
Example:
Write 1 to the brightness file when you need the USER1 light to be on
echo 1 > /sys/class/leds/user1/brightness
When the USER1 light is needed to flash, the timer is written to the trigger file, and the light and off times are controlled by delay_on and delay_off
Echo # start timer
timer > / sys/class/leds light echo 1 seconds/user1
/ trigger
#
> 1000 / sys/class/leds/user1 / delay_on
echo out
# 1 seconds
1000 > /sys/class/leds/user1/delay_off
Full shell script:
#!/bin/bash
USER1_BRIGTHNESS="/sys/class/leds/user1/brightness"
USER1_TRIGGER="/sys/class/leds/user1/trigger"
USER1_DELAY_ON="/sys/class/leds/user1/delay_on"
USER1_DELAY_OFF="/sys/class/leds/user1/delay_off"
# Light the USER1 LED
if [ -f "$USER1_BRIGTHNESS" ]; then
echo 1 > $USER1_BRIGTHNESS
else
echo "no file exit "$USER1_BRIGTHNESS
fi
# Set the USER1 LED to flash
if [ -f "$USER1_TRIGGER" ]; then
echo timer > $USER1_TRIGGER
else
echo "no file exit "$USER1_TRIGGER
fi
# Set the USER1 LED on for 1000ms
if [ -f "$USER1_DELAY_ON" ]; then
echo 1000 > $USER1_DELAY_ON
else
echo "no file exit "$USER1_DELAY_ON
fi
# Set the USER1 LED off for 1000ms
if [ -f "$USER1_DELAY_OFF" ]; then
echo 1000 > $USER1_DELAY_OFF
else
echo "no file exit "$USER1_DELAY_OFF
fi
# Turn off USER1 blinking
if [ -f "$USER1_TRIGGER" ]; then
echo none > $USER1_TRIGGER
else
echo "no file exit "$USER1_TRIGGER
fi
A user's own c/ C ++ program can be cross-compiled by using the cross-compilation toolchain on the development machine, and then the object file is uploaded to the EC300 device for execution.
Cross-compilation tool zip package: gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.gz
Here's how to configure the environment variables for the cross-compilation toolchain:
Using the classic hello world program as an example, create the following directories and files
mkdir ~/example
touch ~/example/hello.c
touch ~/example/Makefile
The contents of the ~/example/hello.c file are as follows:
#include <stdio.h>
int main(void)
{
printf("hello, world! \n");
return 0;
}
The contents of the ~/example/Makefile are as follows:
# Define TARGET and source filenames
target := hellworld
DIRS := $(shell find.-maxdepth 3-type d)
SRCS := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.c))
OBJS := $(SRCS:.c=.o)
CC=aarch64-linux-gnu-gcc
# Define compiler and compile options
CFLAGS := -Wall-Wextra -g-wno-unused-parameters
# define default TARGET
all: $(TARGET)
# define target file dependencies and compile commands
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(LIBS) $^ -o $@
# Define the command to compile the source file to the target file
%.o: %.c
$(CC) $(CFLAGS) $(LIBS) -C $< -o $@
# Define command to clear temporary files
clean:
rm -f $(TARGET) $(OBJS)
# declare pseudo target ".PHONY"
.PHONY: all clean
Run make in the ~/example directory to generate the object file helloworld