IOT-GATE-iMX8 and SBC-IOT-iMX8: Debian Linux: How-To Guide

From Compulab Mediawiki
Revision as of 16:29, 4 May 2020 by imported>Igor.vaisbein (See also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

The example run-time Linux filesystem image for the CompuLab IOT-GATE-iMX7 Internet of Things Gateway and SBC-IOT-iMX7 Internet of Things Single Board Computer is based on Debian GNU/Linux stretch. The CompuLab Linux package for IOT-GATE-iMX8 and SBC-IOT-iMX8 includes ready to run image, and an archive of the root filesystem, used to create the image.

The default Debian buster Linux image includes more than 350 software packages. Among them:

  • Core system
  • Debian package management system
  • SSH server and client
  • PulseAudio configuration and usage utilities
  • NetworkManager
  • ModemManager
  • Bluez5 Bluetooth tools and daemons
  • Docker

Connection and Login

This Debian rootfs comes with a default sudo user compulab:

Debian GNU/Linux 10 iot-gate-imx8 ttymxc2

cl-debian login: compulab
Password: compulab

This Debian rootfs comes without a default root password. The root password has to be set at the very first login:

Debian GNU/Linux 10 iot-gate-imx8 ttymxc2

cl-debian login: root
You are required to change your password immediately (administrator enforced)
New password: 
Retype new password: 

To login into the Linux system, you may use a terminal emulator as described here, or connect through the network (ssh).

Admolition important.png The following examples assume root user.

Package Management

The IOT-GATE-iMX8 / SBC-IOT-iMX8 Debian Linux image includes everything required to use the Debian package management utilities. You can use apt-get and dpkg out of the box.

Docker

The Docker Engine is preinstalled.

  • The following command downloads a test image and runs it in a container. The container sample prints a message and exits.
root@iot-gate-imx8:~# docker run hello-world
  • Verify that the following message is generated (among other messages):
Hello from Docker!
This message shows that your installation appears to be working correctly.

Networking

To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, /etc/hostname and /etc/hosts. For more information about Debian Linux network configuration read:

The majority of network setup can be done via the interfaces configuration file at /etc/network/interfaces.

Admolition note.png auto line is required for interfaces that have to be brought up at boot time.
  • Using DHCP to automatically configure the interface
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
  • Configuring the interface manually
auto eth0
    iface eth0 inet static
        address 192.168.1.170
        netmask 255.255.0.0
        gateway 192.0.0.1

WiFi

IOT-GATE-iMX8 / SBC-IOT-iMX8 features an optional 802.11ac WiFi interface, implemented with the Intel WiFi 6 AX200 module.

Simple Scanning

  • Activate the interface:
root@iot-gate-imx8:~# ifconfig wlp1s0 up
  • Sample WiFi scanning:
root@iot-gate-imx8:~# iwlist wlp1s0 scan

The output will show the list of Access Points and Ad-Hoc cells in range. For more information about tuning WiFi interfaces refer to the “wireless-tools” man pages.

Connecting to an Access Point

The NetworkManager can be used to connect to an access point. In the following example:

  • Replace SSID with the wireless network name.
  • Replace PASSWORD with the wireless network name.
root@iot-gate-imx8:~# nmcli radio wifi on
root@iot-gate-imx8:~# nmcli dev wifi con "SSID" password clwnen04 name "PASSWORD"

Bluetooth

IOT-GATE-iMX8 / SBC-IOT-iMX8 features an optional Bluetooth 5.1 BLE interface, implemented with the Intel WiFi 6 AX200 module.

Host Controller Interface (HCI) Initialization

  • HCI requires no user interaction for being configured. The driver gets loaded automatically unless this option has been disabled by putting a black list rule for this device.
  • HCI device configuration utility can be run to retrieve detailed information about the Bluetooth interfaces:
root@iot-gate-imx8:~# hciconfig hci0 -a
hci0:   Type: Primary  Bus: USB
        BD Address: 38:00:25:AF:FF:59  ACL MTU: 1021:4  SCO MTU: 96:6
        UP RUNNING
        RX bytes:751 acl:0 sco:0 events:52 errors:0
        TX bytes:2676 acl:0 sco:0 commands:52 errors:0
        Features: 0xbf 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'iot-gate-imx8'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Version: 5.0 (0x9)  Revision: 0x100
        LMP Version: 5.0 (0x9)  Subversion: 0x100
        Manufacturer: Intel Corp. (2)
  • If the HCI device is not running, use the below command to enable the HCI device:
root@iot-gate-imx8:~#  hciconfig hci0 up
  • HCI Inquire remote devices.
root@iot-gate-imx8:~# hcitool scan
Scanning ...

Controller–area network (CAN)

IOT-GATE-iMX8 / SBC-IOT-iMX8 features an optional FCAN2 add-on board with two MCP2518FD chips. Each MCP2518FD implements full CAN protocol version 2.0B and CAN FD, supports both the standard and the extended frame format.

CAN interface configuration

  • Configure the CAN interface bit-rate to 1 Mbits/sec:
root@iot-gate-imx8:~# ip link set can0 type can bitrate 1000000
  • Enable the CAN interface:
root@iot-gate-imx8:~# ip link set can0 up

Send/Receive packets

Use cansend and candump utilities to send and receive packets via CAN interface.

  • Send standard CAN frame (on the first device):
root@iot-gate-imx8:~# cansend can0 111#1122334455667788
  • Send extended CAN frame (on the first device):
root@iot-gate-imx8:~# cansend can0 11111111#1122334455667788
  • CAN frames (extended mode) generator, random payload, interval between two successive flames 50 msec:
root@iot-gate-imx8:~# cangen -g 50 -e -D r -v can0
can: raw protocol (rev 20170425)
...
  can0  03FF0983#D7.61.FF.03.C1.F7.C1.34
  can0  19C34D32#F7.5A.C2.73.AD.0E.3F.0B
  can0  0675E391#2B.2D.D3.49
  can0  13091C55#99.32.EC.77.27.81.49.0B
  can0  098D67CF#22.50.AB.48.AD.7F.F4.26
  can0  05263FEC#1B.4C.02.45.6E
  can0  12B30E20#
  can0  1F193DF9#C5
  can0  1EB0B18F#3E.3F.DA.57.C2.FE.73.58
  can0  1E5C64D9#6F.0D.B3.63.6A
  can0  1E1DE3F9#96.48.AC.79.4E.00.27.71
  can0  0E1A11B7#75.81.70.7C.86.79.A7.77
  can0  05F8FD8B#33.F9.9B.1E.77.3D.1F
  can0  1E155FCD#E6.BA.F8.58.ED.6D.C8.10
  can0  1D91DF9E#5D.29.82.7B.97.1D.AB.5C
  can0  11FB3CDA#14.65.C3
  can0  091352C0#2C.ED
...
  • Dump all received data frames as well as error frames (on the second device):
root@iot-gate-imx8:~# candump any,0:0,#FFFFFFFF
  can0  111   [8]  11 22 33 44 55 66 77 88
  can0  11111111   [8]  11 22 33 44 55 66 77 88
...
  can0  03FF0983   [8]  D7 61 FF 03 C1 F7 C1 34
  can0  19C34D32   [8]  F7 5A C2 73 AD 0E 3F 0B
  can0  0675E391   [4]  2B 2D D3 49
  can0  13091C55   [8]  99 32 EC 77 27 81 49 0B
  can0  098D67CF   [8]  22 50 AB 48 AD 7F F4 26
  can0  05263FEC   [5]  1B 4C 02 45 6E
  can0  12B30E20   [0] 
  can0  1F193DF9   [1]  C5
  can0  1EB0B18F   [8]  3E 3F DA 57 C2 FE 73 58
  can0  1E5C64D9   [5]  6F 0D B3 63 6A
  can0  1E1DE3F9   [8]  96 48 AC 79 4E 00 27 71
  can0  0E1A11B7   [8]  75 81 70 7C 86 79 A7 77
  can0  05F8FD8B   [7]  33 F9 9B 1E 77 3D 1F
  can0  1E155FCD   [8]  E6 BA F8 58 ED 6D C8 10
  can0  1D91DF9E   [8]  5D 29 82 7B 97 1D AB 5C
  can0  11FB3CDA   [3]  14 65 C3
  can0  091352C0   [2]  2C ED
...

Cellular Modem

The IOT-GATE-iMX8 / SBC-IOT-iMX8 features an optional cellular modem implemented with a mini-PCIe module. On-board micro-SIM card socket is available.

ModemManager

The ModemManager can be used to log into almost any Internet Service Provider with simple configuration setup.

In the following example:

  • Replace ISP-APN with the APN name of the cellular provider.
root@iot-gate-imx8:~# nmcli connection add type gsm ifname ttyUSB2 con-name CellularCon apn ISP-APN

GPS

Optional GPS interface is implemented with the cellular modem module.
The cgps client can be used to display the GPS information. The cgps client utility depends on the gpsd daemon (starts automatically).

  • Connect to the modem configuration port with Minicom:
root@iot-gate-imx8:~# minicom -D /dev/ttyUSB3
  • Enable the GPS with the following commands:

AT+CGPS=1,1

  • Verify that the OK respond is generated.
  • Exit minicom (CTL-a, x).
  • Start the cgps client to display GPS information.

The synchronization process might take a few minutes.

root@iot-gate-imx8:~# cgps
┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│    Time:       2020-05-04T14:13:30.000Z   ││PRN:   Elev:  Azim:  SNR:  Used: │
│    Latitude:    32.65985123 N             ││  71    29    123    22      Y   │
│    Longitude:   35.10027205 E             ││  85    27    047    22      Y   │
│    Altitude:   102.700 m                  ││                                 │
│    Speed:      0.00 kph                   ││                                 │
│    Heading:    128.7 deg (true)           ││                                 │
│    Climb:      6.00 m/min                 ││                                 │
│    Status:     3D FIX (53 secs)           ││                                 │
│    Longitude Err:   n/a                   ││                                 │
│    Latitude Err:    n/a                   ││                                 │
│    Altitude Err:    +/- 18 m              ││                                 │
│    Course Err:      n/a                   ││                                 │
│    Speed Err:       n/a                   ││                                 │
│    Time offset:     -3.682                ││                                 │
│    Grid Square:     KM72np                ││                                 │
└───────────────────────────────────────────┘└─────────────────────────────────┘

RS485 / RS232

IOT-GATE-iMX8 / SBC-IOT-iMX8 features a half-duplex RS485 port.
The RS485 interface is routed to rear panel terminal block connector (see drawing).
RS485 / RS232 connector pin-out in RS485 mode:

Pin Number RS485 Functionality
1 NEG A/-
2 NEG B/+
3 Ground
6 Ground

Example

Serial terminal emulator application can be used to test the RS485 port.

  • Use the following command to start Minicom with the user space device of the RS485 (/dev/ttymxc0).
root@iot-gate-imx8:~# minicom -D /dev/ttymxc0
  • Follow the following steps to disable hardware flow control
    • Open the menu "Configure Minicom" with CTRL-a followed by the letter 'o'.
    • Select "Serial port setup"
    • Press the letter 'f'.
    • Press the Esc key twice.
  • The characters that are typed in the terminal are transmitted to the RS485 port.
  • The characters that are received from the RS485 port are displayed in the terminal.
  • Press CTRL-a followed by the letter 'x' to exit from Minicom

See also