IOT-DIN-IMX8PLUS: Yocto Linux: How-To Guide
Contents
Overview
The example run-time Yocto Linux image for the CompuLab IOT-DIN-IMX8PLUS was generated with Kirkstone Yocto build. The image includes the needed drivers and utilities to operate the hardware components of the IOT-DIN-IMX8PLUS.
The default Kirkstone Yocto image includes many software packages. Among them:
- Core system
- SSH server and client
- ConnMan
- ModemManager
- Bluez5 Bluetooth tools and daemons
- SocketCAN
- Minicom
Serial Console
IOT-DIN-IMX8PLUS provides a serial console on the front panel micro-USB DBG connector.
Connecting to a host PC
- Use a micro-USB cable to connect the Console connector to a USB port on your host PC.
- Make sure the CP2104 driver is available with your operating system, otherwise install CP2104 driver onto the host PC from https://www.silabs.com/documents/public/software/CP210x_Windows_Drivers_with_Serial_Enumeration.zip
- Identify the host PC interface and port number that will be used for communication with the device:
- In most Linux PCs, the serial port will be denoted as one of the following (where n is a positive integer): /dev/ttyUSB0, /dev/ttyUSB1 ... /dev/ttyUSBn
- In Windows PCs, the serial port usually will be denoted as one of the following (where n is a positive integer): COM1, COM2 ... COMn
- Start a terminal emulation program (such as PuTTY on Windows or minicom on Linux).
- In the port configuration section of the terminal emulation program select the port identified in previous step and set the following serial port parameters:
Baud Rate Data Bits Stop Bits Parity Flow Control 115200 8 1 none none
Connection and Login
This Yocto rootfs comes with an empty root password. No password is required for login.
To login into the Linux system, you may use a terminal emulator as described here, or connect through the network (ssh).
![]() |
The following examples assume root user. |
Gateway Configurator
During O/S boot IOT-DIN-IMX8PLUS automatically runs the Gateway configurator script that detects WiFi/Bluetooth modules and Cellular modem, and configures the virtual device files used to address these devices as well as Industrial I/O Interfaces such as CAN, Digital I/O and etc.
The script creates access files for all permanent and detected optional devices and interfaces.
Gateway Interfaces
Gateway interfaces access directory example:
├── cmd_button │ └── event -> /dev/input/event1 ├── industrial_io │ ├── can -> /sys/class/net/can0 │ ├── di.map │ ├── do.map │ ├── ttyRS232 -> /dev/ttyRS232 │ └── ttyRS485 -> /dev/ttyRS485 ├── leds │ ├── green_a -> /sys/class/leds/Green_A │ ├── green_b -> /sys/class/leds/Green_B │ ├── red_a -> /sys/class/leds/Red_A │ └── red_b -> /sys/class/leds/Red_B └── network ├── bluetooth -> /sys/class/bluetooth/hci0 ├── modem │ ├── at1 -> /dev/ttyModemAT1 │ ├── at2 -> /dev/ttyModemAT2 │ ├── gps -> /dev/ttyModemGPS │ └── qcdm -> /dev/ttyModemQCDM └── wlan -> /sys/class/net/mlan0
Cellular Modem
IOT-DIN-IMX8PLUS cellular interface is implemented with a mini-PCIe cellular modem module and a
nano-SIM socket.
Cellular module is an optional module and should be pre-installed into the gateway. Verify your gateway configuration for modem functionality.
To set up IOT-DIN-IMX8PLUS for cellular functionality, insert a tray with active SIM card into designated socket. Please refer to IOT-DIN-IMX8PLUS user's manual for details.
Cellular antenna should be connected to SMA connector B on the front panel.
Cellular Connection
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@iotdin-imx8p:~$ nmcli connection add type gsm ifname '*' con-name CellularCon apn <ISP-APN>
- Connect cellular network
root@iotdin-imx8p:~$ nmcli connection up CellularCon
- Disconnect cellular network
root@iotdin-imx8p:~$ nmcli connection down CellularCon
Modem Reset
The cellular modem module can be forced into hardware reset by toggling pin 5 of GPIO expander (gpiochip5).
Use the following command to reset the modem:
root@iotdin-imx8p:~$ gpioset 5 5=0 ; sleep 0.3 ; gpioset 5 5=1
GPS
IOT-DIN-IMX8PLUS features an optional GPS interface implemented with the cellular modem module.
Cellular module is an optional module and should be pre-installed into the gateway. Verify your gateway configuration for modem functionality.
During O/S boot IOT-DIN-IMX8PLUS will automatically detect cellular modem and create necessary access files if installed. For additional details please refer to the Configuration chapter.
Example
For IOT-DIN-IMX8PLUS with cellular modem option (JEG2xG) the configurator script will create the following access files:
/run/iotdin-imx8p/gateway/access/network/modem/ |-- at1 -> /dev/ttyModemAT1 |-- at2 -> /dev/ttyModemAT2 |-- gps -> /dev/ttyModemGPS `-- qcdm -> /dev/ttyModemQCDM
GPS antenna
A GPS antenna is required for GPS operation. GPS antenna is not included with IOT-DIN-IMX8PLUS. Any active GPS antenna with a male SMA connector can be used with IOT-DIN-IMX8PLUS.
GPS antenna should be attached to SMA connector A on the gateway.
![]() |
GPS antenna should be positioned at least 1m away from the gateway |
Using GPS
The cgps client can be used to display the GPS information.
The ModemManager can be used to check the modem status.
For example, the following command shows the presence of the modem and the id of its interfaces.
root@iotdin-imx8p:~# mmcli -m 0
The cgps client utility depends on the gpsd daemon (starts automatically after the initialization command is performed).
- Detect the GPS device:
root@iotdin-imx8p:~$ gps=$(readlink -e /run/iotdin-imx8p/gateway/access/network/modem/gps)
- Initialize the GPS interface:
root@iotdin-imx8p:~# sudo sed -i "/^DEVICES=.*/c\DEVICES=\"${gps}\"" /etc/default/gpsd
- Detect the primary AT modem device:
root@iotdin-imx8p:~$ at1=$(readlink -e /run/iotdin-imx8p/gateway/access/network/modem/at1)
- Enable the GPS with the following AT commands:
root@iotdin-imx8p:~# echo "AT+QGPS=1" | sudo socat - ${at1},crnl
- Full power cycle is required before using GPS. Shut down the gateway, remove main DC power for at least 20 sec and restart.
- Start the cgps client to display GPS information.
The synchronization process might take a few minutes.
root@iotdin-imx8p:~# cgps ┌───────────────────────────────────────────┐┌─────────────────────────────────┐ │ Time: 2024-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 ││ │ └───────────────────────────────────────────┘└─────────────────────────────────┘
- Disable the GPS with the following AT commands:
root@iotdin-imx8p:~# echo "AT+QGPSEND" | sudo socat - ${at1},crnl
WiFi
Enable/Disable WiFi Interface
- To enable WiFi interface:
root@iotdin-imx8p:~# nmcli radio wifi on
- To disable WiFi interface:
root@iotdin-imx8p:~# nmcli radio wifi off
Network Scanning
- Sample WiFi scanning:
root@iotdin-imx8p:~# nmcli dev wifi list
- The output will show the list of Access Points and Ad-Hoc cells in range.
Connecting to Access Point
In the following example:
- Replace <SSID> and <PASSWORD> with the actual access point parameters:
root@iotdin-imx8p:~# nmcli device wifi connect <SSID> password <PASSWORD> name WifiCon
- Disconnect wireless network:
root@iotdin-imx8p:~# nmcli connection down WifiCon
- Connect wireless network again:
root@iotdin-imx8p:~# nmcli connection up WifiCon
Industrial Interfaces
IOT-DIN-IMX8PLUS implements following industrial interfaces on the 16-pin industrial terminal block:
1x RS232 (2-wire); 1x RS485 (half-duplex); 1x CAN 2.0B; 2x digital inputs; 2x digital outputs.
Please refer to Industrial I/O Connector pin-out for more details.
CAN
IOT-DIN-IMX8PLUS features one CAN 2.0B port implemented with i.MX8M Plus CAN controller.
CAN bus signals are routed to industrial I/O connector.
CAN interface configuration
- Configure the CAN interface bit-rate to 1 Mbits/sec:
root@iotdin-imx8p:~# ip link set can0 type can bitrate 1000000
- Enable the CAN interface:
root@iotdin-imx8p:~# 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@iotdin-imx8p:~# cansend can0 111#1122334455667788
- Send extended CAN frame (on the first device):
root@iotdin-imx8p:~# cansend can0 11111111#1122334455667788
- CAN frames (extended mode) generator, random payload, interval between two successive flames 50 msec:
root@iotdin-imx8p:~# cangen -g 50 -e -D r -v can0 ... ...
- Dump all received data frames as well as error frames:
root@iotdin-imx8p:~# candump any,0:0,#FFFFFFFF ... ...
RS232
RS232 function is implemented with MAX3221 (or compatible) transceiver interfaced with i.MX8M Plus UART port.
Configuration and Access
The configurator script will create the following access file for RS232 interface:
/run/iotdin-imx8p/gateway/access/industrial_io/ |-- ... |-- ttyRS232 -> /dev/ttyRS232 |-- ...
- Detect the underlying tty:
root@iotdin-imx8p:~$ ttyRS232=$(readlink -e /run/iotdin-imx8p/gateway/access/industrial_io/ttyRS232)
- Access the RS232 interface can be accessed in Linux via the tty device in ttyRS232 variable:
root@iotdin-imx8p:~$ stty -F ${ttyRS232}
RS485
RS485 function is implemented with MAX13488 (or compatible) transceiver interfaced with i.MX8M Plus UART port.
Configuration and Access
The configurator script will create the following access file for RS485 interface:
/run/iotdin-imx8p/gateway/access/industrial_io/ |-- ... |-- ttyRS485 -> /dev/ttyRS485 |-- ...
- Detect the underlying tty:
root@iotdin-imx8p:~$ ttyRS485=$(readlink -e /run/iotdin-imx8p/gateway/access/industrial_io/ttyRS485)
- Access the RS485 interface can be accessed in Linux via the tty device in ttyRS485 variable:
root@iotdin-imx8p:~$ stty -F ${ttyRS485}
RS485 has an optional hardware-enabled termination. Please consult with the reference guide for enabling instructions.
Modbus RS485
The following example demonstrates how to use RS485 module installed into industrial I/O slot A in a Modbus RS485 Network. IOTG-IMX8PLUS performs as a Master device and queries XY-MD02 temperature and humidity sensor.
Software installation
Download and install modpoll - a command line based Modbus master simulator and test utility.
root@iotdin-imx8p:~# wget https://www.modbusdriver.com/downloads/modpoll.tgz -P /tmp/ ... root@iotdin-imx8p:~# tar -xvf /tmp/modpoll.tgz -C /opt/ ...
Device connection
- Connect XY-MD02 sensor to appropriate Industrial I/O connector pins as below:
- A+: XY-MD02 A+ to IOT-DIN-iMX8PLUS I/O PIN 8
- B-: XY-MD02 B- to IOT-DIN-iMX8PLUS I/O PIN 7
------------------- -------------------- | | | IOTDIN-IMX8P | | *--(+)---< <------- 5V-30V | | | | | | | *--(-)---< <-------- GND | | | XY-MD02 (RS485) | |------ | | *--(A+)--< <--...--> >-(8)-*-| | Industrial | | | | J4 | I/O | | *--(B-)--< <--...--> >-(7)-*-| | Connector | | | |------ | ------------------- --------------------
Read data
- Read temperature once:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 3 -c 1 -r 2 -1 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC4 Slave configuration...: address = 1, start reference = 2, count = 1 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave... [2]: 250
- Poll temperature:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 3 -c 1 -r 2 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC4 Slave configuration...: address = 1, start reference = 2, count = 1 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave... (Ctrl-C to stop) [2]: 254 -- Polling slave... (Ctrl-C to stop) [2]: 254 -- Polling slave... (Ctrl-C to stop) [2]: 254 ...
- Read humidity once:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 3 -c 1 -r 3 -1 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC4 Slave configuration...: address = 1, start reference = 3, count = 1 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave... [3]: 515
- Poll humidity:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 3 -c 1 -r 3 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC4 Slave configuration...: address = 1, start reference = 3, count = 1 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave... (Ctrl-C to stop) [3]: 894 -- Polling slave... (Ctrl-C to stop) [3]: 895 -- Polling slave... (Ctrl-C to stop) [3]: 896 ...
- Read temperature & humidity once:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 3 -c 2 -r 2 -1 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC4 Slave configuration...: address = 1, start reference = 2, count = 2 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave... [2]: 263 [3]: 606
- Poll temperature & humidity:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 3 -c 2 -r 2 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC4 Slave configuration...: address = 1, start reference = 2, count = 2 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave... (Ctrl-C to stop) [2]: 263 [3]: 545 -- Polling slave... (Ctrl-C to stop) [2]: 263 [3]: 543 -- Polling slave... (Ctrl-C to stop) [2]: 263 [3]: 542 ...
- Read slave address, baudrate, temperature & humidity corrections:
root@iotdin-imx8p:~# /opt/modpoll/arm-linux-gnueabihf/modpoll -b 9600 -p none -t 4 -c 4 -r 258 -1 ${ttyRS485} modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2002-2021 proconX Pty Ltd Visit https://www.modbusdriver.com for Modbus libraries and tools. Protocol configuration: Modbus RTU, FC3 Slave configuration...: address = 1, start reference = 258, count = 4 Communication.........: /dev/ttyRS485_A, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, output (holding) register table -- Polling slave... [258]: 1 [259]: 9600 [260]: 0 [261]: 0
Digital I/O
IOT-DIN-IMX8PLUS features 2 digital inputs and 2 digital outputs.
2 digital inputs are implemented with the CLT03-2Q3 digital termination following EN 61131-2.
2 digital outputs are implemented with the TPS272C solid-state relay following EN 61131-2.
Please refer to IOT-DIN-IMX8PLUS user's manual for Industrial I/O Connector pin-out.
---------------- | IOTD-IMX8P | | ______| | | VIN 1| +24VDC | | DI0 2| <<------| | | DO0 3| >>------| | T.B. | DI1 4| <<------| | | DO1 5| >>------| | | COM 6| 0V | | | ----------------
![]() |
External voltage supply in the range 6-24VDC must be supplied via DIO_VIN pin for correct operation of digital outputs. Please refer to Industrial I/O Connector pin-out for more details. |
Configuration and Access
The example below shows how to access Digital inputs and outputs.
Digital Outputs
- Drive OUT0 pin HI:
root@iotdin-imx8mp:~$ sudo gpioset 3 30=1
- Drive OUT1 pin HI:
root@iotdin-imx8mp:~$ sudo gpioset 4 4=1
![]() |
gpioget function doesn't allow to verify the pin state. gpioget function will always return 0 on the OUT1 and OUT2 pin |
Another way to set the pin state is the usage of dioset bash script located at /opt/iotdin-imx8p/shell
- Setup alias for more convenient work:
root@iotdin-imx8mp:~$ dioset=/opt/iotdin-imx8p/shell/dioset
- Drive OUT0 pin HI:
root@iotdin-imx8mp~$ sudo ${dioset} -m M 0 1
- Drive OUT0 pin LOW:
root@iotdin-imx8mp:~$ sudo ${dioset} -m M 0 0
- Drive OUT1 pin HI:
root@iotdin-imx8mp:~$ sudo ${dioset} -m M 1 1
- Drive OUT1 pin LOW:
root@iotdin-imx8mp:~$ sudo ${dioset} -m M 1 0
Digital Inputs
- Read IN0 pin state:
root@iotdin-imx8mp:~$ sudo gpioget 4 3
- Read IN1 pin state:
root@iotdin-imx8mp:~$ sudo gpioget 4 0
Another way to set the pin state is the usage of dioget bash script located at /opt/iotdin-imx8p/shell
- Setup alias for more convenient work:
root@iotdin-imx8mp:~$ dioget=/opt/iotdin-imx8p/shell/dioget
- Read IN0 pin state:
root@iotdin-imx8mp:~$ sudo ${dioget} -m M 0
- Read IN1 pin state:
root@iotdin-imx8mp:~$ sudo ${dioget} -m M 1
RTC
IOT-DIN-IMX8PLUS RTC is implemented with the AM1805 real-time clock (RTC) chip.
Back-up battery keeps the RTC running to maintain clock and time information whenever the main power supply is not present.
Accessing and setting the RTC
- To access the RTC time and date run:
compulab@iot-gate-imx8plus:~$ sudo hwclock 2022-08-04 12:38:10.577874+00:00
- To set the date and write it into the RTC do the following:
compulab@iot-gate-imx8plus:~$ sudo date -s "31 Dec 2021 10:00:00" Fri Dec 31 10:00:00 IST 2021 compulab@iot-gate-imx8plus:~$ sudo hwclock -w compulab@iot-gate-imx8plus:~$ sudo hwclock 2021-12-31 10:00:08.317403+02:00
Watchdog
IOT-DIN-IMX8PLUS watchdog function is implemented with the i.MX8M Plus watchdog.
By default, the watchdog is not configured.
root@iotdin-imx8p:~$ systemctl show | grep RuntimeWatchdog
RuntimeWatchdogUSec=0
The value RuntimeWatchdogUSec=0 means watchdog logic is disabled: no watchdog device is opened, configured, or pinged
Watchdog configuration
- Edit /etc/systemd/system.conf file to configure watchdog related parameters, in particular RuntimeWatchdogSec.
- RuntimeWatchdogSec - specifies the watchdog timeout for runtime services, meaning services that are actively running during normal system operation.
![]() |
Remove the starting hash (#) symbol if found, set the positive integer to specify the Watchdog timer in seconds |
- Reboot the device
- Verify watchdog configuration
root@iotdin-imx8p:~$ systemctl show | grep RuntimeWatchdog
RuntimeWatchdogUSec=10s
Watchdog testing
- Run the following command to simulate kernel panic:
root@iotdin-imx8p:~# echo "c" > /proc/sysrq-trigger
- As a result, the watchdog is not fed and the system reboots after 10 sec.
LEDs
IOT-DIN-IMX8PLUS features two user Bi-Color (Red + Green) LEDs named A and B LEDs are controlled via GPIO pins and can be accessed via sysfs interface.
- LEDs are referred to as Green_A, Red_A, Green_B and Red_B
- Choose a LED (LED B Red in this example):
root@iotdin-imx8p:~$ LED=Red_B
- Turn the LED ON
root@iotdin-imx8p:~$ echo "1" | sudo tee -a /sys/class/leds/${LED}/brightness
- Turn the LED OFF
root@iotdin-imx8p:~$ echo "0" | sudo tee -a /sys/class/leds/${LED}/brightness
- Set LED's trigger
root@iotdin-imx8p:~$ echo "heartbeat" | sudo tee -a /sys/class/leds/${LED}/trigger
TPM
IOT-DIN-IMX8PLUS assembled with TPM 2.0 implemented with Infineon SLB9673.
TPM Initialization
The TPM driver is loaded gets loaded automatically
- Make sure that the TPM kernel object is loaded:
root@iotdin-imx8p:~# lsmod | grep tpm_tis_i2c
- Load the TPM kernel object manually is required:
root@iotdin-imx8p:~$ modprobe tpm_tis_i2c
TPM Basic Functionality
- Install the tpm2-tools package:
root@iotdin-imx8p:~$ sudo apt-get update && sudo apt-get install tpm2-tools
- Validate basic functionality
root@iotdin-imx8p:~$ sudo tpm2_getrandom --hex 32
The correct result will be returned generated 32-symbol key.