Difference between revisions of "IOT-DIN-IMX8PLUS: Debian Linux: I/O Modules Guide"

From Compulab Mediawiki
Jump to: navigation, search
(Created page with "{{Important| '''This page is under construction'''}}")
 
 
Line 1: Line 1:
{{Important| '''This page is under construction'''}}
+
= Overview =
 +
IOT-DIN-IMX8PLUS supports up to eight I/O Expansion Modules that can be stacked with the main gateway in order to extend the feature set of the system.
 +
A gateway assembly includes one gateway (the left most unit) and multiple I/O Expansion modules. Module stacking is done from left to right. Up to 8 I/O Expansion Modules can be supported in one gateway assembly.
 +
The modules are interconnected using Compulab’s proprietary StackLink expansion connector that extends a series of the IOT-DIN-IMX8PLUS interfaces, creating a chain of peripherals.
 +
 
 +
= I/O Modules Configuration =
 +
I/O expansion  modules are managed as a front-plane of virtual slots that map device access files to physical I/O modules per their positions in the stack.<br>
 +
During O/S boot IOT-DIN-IMX8PLUS automatically runs the StackLink configurator script that detects I/O modules and configures the virtual device files used to address the hardware.<br>
 +
The script creates the IFM front-plane file directory that includes type and access files for all populated stack slots.
 +
 
 +
== IFM Front-Plane ==
 +
 
 +
During O/S boot the StackLink configurator script creates the IFM front-plane file directory that includes type and access files for all populated stack slots (from A to last populated slot).
 +
 
 +
<pre>
 +
/run/iotdin-imx8p/stack/frontplane
 +
</pre>
 +
'''Front-plane directory structure'''
 +
 
 +
Example I/O modules stack:
 +
 
 +
<pre>
 +
 
 +
+----------+-------+-------+-------+-------+
 +
|  Slot #  |  A  |  B  |  C  |  D  |
 +
+----------+-------+-------+-------+-------+
 +
| IFM Type | ADC8  | DI8O8 | RS485 | RS232 |
 +
+----------+-------+-------+-------+-------+
 +
</pre>
 +
 
 +
Front-plane file directory:
 +
 
 +
<pre>
 +
/run/iotdin-imx8p/stack/frontplane
 +
|-- A
 +
|  |-- access
 +
|  |  |-- adc0 -> /sys/bus/iio/devices/iio:device0
 +
|  |  `-- adc1 -> /sys/bus/iio/devices/iio:device1
 +
|  `-- type.ADC8
 +
|-- B
 +
|  |-- access
 +
|  |  |-- di.map
 +
|  |  |-- do.map
 +
|  |  `-- gpiochip -> /dev/gpiochip6
 +
|  `-- type.DI8O8
 +
|-- C
 +
|  |-- access
 +
|  |  |-- tty0 -> /dev/ttyIFM_RSx_0_0
 +
|  |  |-- tty1 -> /dev/ttyIFM_RSx_0_1
 +
|  |  |-- tty2 -> /dev/ttyIFM_RSx_0_2
 +
|  |  `-- tty3 -> /dev/ttyIFM_RSx_0_3
 +
|  `-- type.RS485
 +
`-- D
 +
    |-- access
 +
    |  |-- tty0 -> /dev/ttyIFM_RSx_1_0
 +
    |  |-- tty1 -> /dev/ttyIFM_RSx_1_1
 +
    |  |-- tty2 -> /dev/ttyIFM_RSx_1_2
 +
    |  `-- tty3 -> /dev/ttyIFM_RSx_1_3
 +
    `-- type.RS232
 +
 
 +
</pre>
 +
 
 +
==  Stack Detection Status  ==
 +
StackLink configurator script provides indication of I/O modules stack detection status using IOT-DIN-IMX8PLUS power LED:
 +
{| class="wikitable" style="text-align:left;"
 +
|-
 +
| align="center" | '''''Power LED'''''
 +
| align="center" | '''Status'''
 +
| align="center" | '''Remarks'''
 +
|-
 +
| align="" |''Blinking Blue''
 +
| align="" | Recognized and valid configuration
 +
| align="" | Normal operation
 +
|-
 +
| align="" |''Blinking Amber''
 +
| align="" | Unrecognized I/O module or invalid configuration
 +
| align="" | Check the log for details
 +
|-
 +
 
 +
 
 +
|}
 +
 
 +
==  Stack Detection Info  ==
 +
 
 +
StackLink configurator script stores stack detection info log in the following designated location:
 +
<pre>
 +
/run/iotdin-imx8p/log/iotdin-imx8p.stack.log*
 +
</pre>
 +
 
 +
== Stack Troubleshooting ==
 +
<br>
 +
{{Warning|DO NOT attach or detach I/O Expansion modules while the gateway is connected to DC power! Disconnect all power sources from the gateway before attaching or detaching I/O modules.}}
 +
 
 +
In case of invalid IFM stack status:
 +
# Check the stack detection log
 +
# Verify proper mechanical attachment of modules
 +
# Contact technical support
 +
 
 +
== IFM Backplane ==
 +
<br>
 +
<code>/run/iotdin-imx8p/stack/backplane</code> directory stores the system information about the physical hardware devices installed in the stack. These files should not be altered.
 +
 
 +
= IFM-DI8O8 =
 +
IFM-DI8O8 module provides an isolated block of eight digital inputs and a block of eight digital outputs.<br>
 +
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed IFM-DI8O8 modules and create necessary access files in the front-plane directory. For additional details please refer to the [[IOT-DIN-IMX8PLUS: Debian Linux: I/O Modules Guide#Configuration|Configuration chapter]].<br>
 +
 
 +
Use '''diodetect''' command to get an overview of all available Digital Inputs and Outputs:
 +
<pre>
 +
compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ ./diodetect
 +
Main Gateway:  DI2O2  (2x DI; 2x DO)
 +
Stack Slot B:  DI8O8  (8x DI; 8x DO)
 +
</pre>
 +
Use '''dioget''' and '''dioset''' commands to access digital inputs and digital outputs.
 +
 
 +
== Reading Digital Inputs ==
 +
<pre>
 +
 
 +
compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioget -h
 +
Usage: dioget [options] <command>
 +
 
 +
Read digital input state from a Digital I/O (DIO) module
 +
 
 +
Command:
 +
-m <module> <offset>
 +
        module: DIO module location:
 +
            m|M - Main Gateway
 +
            a|A - Virtual slot A
 +
            ...
 +
            h|H - Virtual slot H
 +
        offset: input pin offset: <0..MaxOffset>
 +
Options:
 +
-h:    display this help and exit
 +
</pre>
 +
 
 +
'''Example'''<br>
 +
Read state of input pin '''IN_4''' on IFM-DI8O8 installed in slot B:
 +
<pre>
 +
compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioget -m B 4
 +
</pre>
 +
 
 +
== Setting Digital Outputs ==
 +
<pre>
 +
 
 +
compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioset -h
 +
Usage: dioset [options] <command>
 +
 
 +
Set the digital output state of a Digital I/O (DIO) module
 +
 
 +
Command:
 +
-m <module> <offset>  <state>
 +
        module: DIO module location:
 +
            m|M - Main Gateway
 +
            a|A - Virtual slot A
 +
            ...
 +
            h|H - Virtual slot H
 +
        offset: output pin offset: <0..MaxOffset>
 +
        state:  output pin state to be set: <0|1>
 +
Options:
 +
-h:    display this help and exit
 +
</pre>
 +
 
 +
'''Example'''<br>
 +
Setting output pin '''OUT_4''' to HIGH state on IFM-DI8O8 installed in slot B:
 +
<pre>
 +
compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioset -m B 4 1
 +
</pre>
 +
 
 +
= IFM-ADC =
 +
IFM-ADC8 provides eight single-ended analog input channels, divided into two blocks of 4. Inputs operate between 0-10V or 4-20mA ranges for use with industrial sensors. Each block can be set into current or voltage input mode via jumper.<br>
 +
 
 +
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed I/O modules and create necessary access files in the front-plane directory. For additional details please refer to the [[IOT-DIN-IMX8PLUS: Debian Linux: I/O Modules Guide#Configuration|Configuration chapter]].<br>
 +
 
 +
Use the following commands to read the detected values:<br>
 +
(table is for the IFM-ADC in stack location '''A''')
 +
{| class="wikitable" style="text-align:center;"
 +
|+
 +
! Channel
 +
! Access File
 +
|-
 +
| 1
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage0_raw
 +
|-
 +
| 2
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage1_raw
 +
|-
 +
| 3
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage2_raw
 +
|-
 +
| 4
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage3_raw
 +
|-
 +
| 5
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage0_raw
 +
|-
 +
| 6
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage1_raw
 +
|-
 +
| 7
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage2_raw
 +
|-
 +
| 8
 +
| ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage3_raw
 +
|}
 +
 
 +
= IFM-RS485 =
 +
IFM-RS485 I/O module provides four half-duplex RS485 ports.</br>
 +
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed I/O modules and create necessary access files in the front-plane directory. For additional details please refer to the [[IOT-DIN-IMX8PLUS: Debian Linux: I/O Modules Guide#Configuration|Configuration chapter]].<br>
 +
 
 +
===Example===
 +
For an IFM-RS485 module installed in slot '''C''' the configurator script will create the following access files:
 +
 
 +
<pre>
 +
/run/iotdin-imx8p/stack/frontplane/
 +
|-- C
 +
|  |-- access
 +
|  |  |-- tty0
 +
|  |  |-- tty1
 +
|  |  |-- tty2
 +
|  |  `-- tty3
 +
|  `-- type.RS485
 +
</pre>
 +
 
 +
Use <code>/run/iotdin-imx8p/stack/frontplane/C/access/tty'''X'''</code> to access port #'''X'''
 +
 
 +
= IFM-RS232 =
 +
 
 +
IFM-RS232 I/O module provides four 2-wire RS232 ports.</br>
 +
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed I/O modules and create necessary access files in the front-plane directory. For additional details please refer to the [[IOT-DIN-IMX8PLUS: Debian Linux: I/O Modules Guide#Configuration|Configuration chapter]].<br>
 +
 
 +
===Example===
 +
For an IFM-RS232 module installed in slot D the configurator script will create the following access files:
 +
 
 +
<pre>
 +
/run/iotdin-imx8p/stack/frontplane/
 +
|-- D
 +
|  |-- access
 +
|  |  |-- tty0
 +
|  |  |-- tty1
 +
|  |  |-- tty2
 +
|  |  `-- tty3
 +
|  `-- type.RS232
 +
</pre>
 +
Use <code>/run/iotdin-imx8p/stack/frontplane/D/access/tty'''X'''</code> to access port #'''X'''

Latest revision as of 09:45, 1 July 2024

Overview

IOT-DIN-IMX8PLUS supports up to eight I/O Expansion Modules that can be stacked with the main gateway in order to extend the feature set of the system. A gateway assembly includes one gateway (the left most unit) and multiple I/O Expansion modules. Module stacking is done from left to right. Up to 8 I/O Expansion Modules can be supported in one gateway assembly. The modules are interconnected using Compulab’s proprietary StackLink expansion connector that extends a series of the IOT-DIN-IMX8PLUS interfaces, creating a chain of peripherals.

I/O Modules Configuration

I/O expansion modules are managed as a front-plane of virtual slots that map device access files to physical I/O modules per their positions in the stack.
During O/S boot IOT-DIN-IMX8PLUS automatically runs the StackLink configurator script that detects I/O modules and configures the virtual device files used to address the hardware.
The script creates the IFM front-plane file directory that includes type and access files for all populated stack slots.

IFM Front-Plane

During O/S boot the StackLink configurator script creates the IFM front-plane file directory that includes type and access files for all populated stack slots (from A to last populated slot).

/run/iotdin-imx8p/stack/frontplane

Front-plane directory structure

Example I/O modules stack:


+----------+-------+-------+-------+-------+
|  Slot #  |   A   |   B   |   C   |   D   |
+----------+-------+-------+-------+-------+
| IFM Type | ADC8  | DI8O8 | RS485 | RS232 |
+----------+-------+-------+-------+-------+

Front-plane file directory:

/run/iotdin-imx8p/stack/frontplane
|-- A
|   |-- access
|   |   |-- adc0 -> /sys/bus/iio/devices/iio:device0
|   |   `-- adc1 -> /sys/bus/iio/devices/iio:device1
|   `-- type.ADC8
|-- B
|   |-- access
|   |   |-- di.map
|   |   |-- do.map
|   |   `-- gpiochip -> /dev/gpiochip6
|   `-- type.DI8O8
|-- C
|   |-- access
|   |   |-- tty0 -> /dev/ttyIFM_RSx_0_0
|   |   |-- tty1 -> /dev/ttyIFM_RSx_0_1
|   |   |-- tty2 -> /dev/ttyIFM_RSx_0_2
|   |   `-- tty3 -> /dev/ttyIFM_RSx_0_3
|   `-- type.RS485
`-- D
    |-- access
    |   |-- tty0 -> /dev/ttyIFM_RSx_1_0
    |   |-- tty1 -> /dev/ttyIFM_RSx_1_1
    |   |-- tty2 -> /dev/ttyIFM_RSx_1_2
    |   `-- tty3 -> /dev/ttyIFM_RSx_1_3
    `-- type.RS232

Stack Detection Status

StackLink configurator script provides indication of I/O modules stack detection status using IOT-DIN-IMX8PLUS power LED:

Power LED Status Remarks
Blinking Blue Recognized and valid configuration Normal operation
Blinking Amber Unrecognized I/O module or invalid configuration Check the log for details

Stack Detection Info

StackLink configurator script stores stack detection info log in the following designated location:

/run/iotdin-imx8p/log/iotdin-imx8p.stack.log*

Stack Troubleshooting


Admolition warning.png DO NOT attach or detach I/O Expansion modules while the gateway is connected to DC power! Disconnect all power sources from the gateway before attaching or detaching I/O modules.

In case of invalid IFM stack status:

  1. Check the stack detection log
  2. Verify proper mechanical attachment of modules
  3. Contact technical support

IFM Backplane


/run/iotdin-imx8p/stack/backplane directory stores the system information about the physical hardware devices installed in the stack. These files should not be altered.

IFM-DI8O8

IFM-DI8O8 module provides an isolated block of eight digital inputs and a block of eight digital outputs.
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed IFM-DI8O8 modules and create necessary access files in the front-plane directory. For additional details please refer to the Configuration chapter.

Use diodetect command to get an overview of all available Digital Inputs and Outputs:

compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ ./diodetect
Main Gateway:   DI2O2   (2x DI; 2x DO)
Stack Slot B:   DI8O8   (8x DI; 8x DO)

Use dioget and dioset commands to access digital inputs and digital outputs.

Reading Digital Inputs


compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioget -h
Usage: dioget [options] <command>

Read digital input state from a Digital I/O (DIO) module

Command:
 -m <module> <offset>
        module: DIO module location:
            m|M - Main Gateway
            a|A - Virtual slot A
            ...
            h|H - Virtual slot H
        offset: input pin offset: <0..MaxOffset>
Options:
 -h:    display this help and exit

Example
Read state of input pin IN_4 on IFM-DI8O8 installed in slot B:

compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioget -m B 4

Setting Digital Outputs


compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioset -h
Usage: dioset [options] <command>

Set the digital output state of a Digital I/O (DIO) module

Command:
 -m <module> <offset>  <state>
        module: DIO module location:
            m|M - Main Gateway
            a|A - Virtual slot A
            ...
            h|H - Virtual slot H
        offset: output pin offset: <0..MaxOffset>
        state:  output pin state to be set: <0|1>
Options:
 -h:    display this help and exit

Example
Setting output pin OUT_4 to HIGH state on IFM-DI8O8 installed in slot B:

compulab@compulab-imx8mp:/opt/iotdin-imx8p/shell$ sudo ./dioset -m B 4 1

IFM-ADC

IFM-ADC8 provides eight single-ended analog input channels, divided into two blocks of 4. Inputs operate between 0-10V or 4-20mA ranges for use with industrial sensors. Each block can be set into current or voltage input mode via jumper.

During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed I/O modules and create necessary access files in the front-plane directory. For additional details please refer to the Configuration chapter.

Use the following commands to read the detected values:
(table is for the IFM-ADC in stack location A)

Channel Access File
1 ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage0_raw
2 ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage1_raw
3 ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage2_raw
4 ../run/iotdin-imx8p/stack/frontplane/A/access/adc0/in_voltage3_raw
5 ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage0_raw
6 ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage1_raw
7 ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage2_raw
8 ../run/iotdin-imx8p/stack/frontplane/A/access/adc1/in_voltage3_raw

IFM-RS485

IFM-RS485 I/O module provides four half-duplex RS485 ports.
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed I/O modules and create necessary access files in the front-plane directory. For additional details please refer to the Configuration chapter.

Example

For an IFM-RS485 module installed in slot C the configurator script will create the following access files:

/run/iotdin-imx8p/stack/frontplane/
|-- C
|   |-- access
|   |   |-- tty0
|   |   |-- tty1
|   |   |-- tty2
|   |   `-- tty3
|   `-- type.RS485

Use /run/iotdin-imx8p/stack/frontplane/C/access/ttyX to access port #X

IFM-RS232

IFM-RS232 I/O module provides four 2-wire RS232 ports.
During O/S boot IOT-DIN-IMX8PLUS will automatically detect installed I/O modules and create necessary access files in the front-plane directory. For additional details please refer to the Configuration chapter.

Example

For an IFM-RS232 module installed in slot D the configurator script will create the following access files:

/run/iotdin-imx8p/stack/frontplane/
|-- D
|   |-- access
|   |   |-- tty0
|   |   |-- tty1
|   |   |-- tty2
|   |   `-- tty3
|   `-- type.RS232

Use /run/iotdin-imx8p/stack/frontplane/D/access/ttyX to access port #X