Maxx GW4100: Unterschied zwischen den Versionen
| Zeile 86: | Zeile 86: | ||
{| class="wikitable" width=" | {| class="wikitable" width="40%" | ||
! Description !! Function !! Label !! Signal !! Pin !! Pin !! Signal !! Label !! Function | ! Description !! Function !! Label !! Signal !! Pin !! Pin !! Signal !! Label !! Function | ||
|- | |- | ||
Version vom 4. Juni 2021, 12:21 Uhr
The Device
Linux login
Per default login to the Linux system is possible by the use of a ssh connection on eth0 or via the serial console on the RS232 interface (115.200 baud, 8N1).
login: root
password: iotmaxx
Please be advised to at least change the password and deactivate the serial console before deploying the device. The use of further security measures (PSK etc.) is strongly encouraged.
Interfaces
The following section describes the various interfaces of the GW4100 in detail. This graphic shows the distribution of the interfaces:
Pinout RS232, RS485, CAN-Bus, 1-Wire connector
| Description | Function | Label | Signal | Pin | Pin | Signal | Label | Function |
|---|---|---|---|---|---|---|---|---|
| #1-wire | 1-Wire | 1w | Data | 1 | 2 | +5V | 5V | Power 1-Wire |
| #CAN | CAN high | CH | High | 3 | 4 | Low | CL | CAN Low |
| GND | GND | GND | 5 | 6 | GND | GND | GND | |
| #RS485 | RS485 | D- | D- | 7 | 8 | D+ | D+ | RS485 |
| #RS232 | RS232 | TXD | TXD | 9 | 10 | CTS | CTS | RS232 |
| RXD | RXD | 11 | 12 | RTS | RTS |
Pinout Digital IN/OUT connector
| Description | Function | Label | Signal | Pin | Pin | Signal | Label | Function |
|---|---|---|---|---|---|---|---|---|
| #Multi-purpose I/O | Multi-purpose I/O 1 | G1 | GPIO1 | 1 | 2 | GPIO2 | G2 | Multi-purpose I/O 2 |
| GND | GND | GND | 3 | 4 | GND | GND | GND | |
| #Digital inputs | Digital Input 1 | l1 | GPI1 | 5 | 6 | GPI2 | l2 | Digital Input 2 |
| Digital Input 3 | l3 | GPI3 | 7 | 8 | GPI4 | I4 | Digital Input 4 |
Power
The device requires an external ES1/PS2 DC power supply 8-30V, 25W.
Ethernet
10/100MBit ethernet interface, per default configured as DHCP server with IP address 192.168.1.1.
USB
USB 2.0 host interface for connection of external USB devices. Please note that an appropriate Linux driver ist required for many devices.
SD card
Micro SD card interface for adding additional non-volatile memory to the system. Please use a SD card to store rapidly changing data (e.g. databases etc.) as the internal flash memory allows limited write cycles before potential memory corruption may occur.
CAN
The interface according to the CAN 2.0B protocol specification is relaized using the i.MX7D’s flexcan interface and a NXP TJA1051 transceiver. It features a switchable 120R termination resistor.
On the Linux side a SocketCAN interface (can0) with a default bitrate of 250.000 bit/s is provided.
The termination resistor is activated by driving CAN_TERM_EN_n low. See Linux mapping for details.
RS485
A non-isolated RS485 interface is available as /dev/ttymxc3. The interface does not include a termination resistor.
RS232
A 4-wire RS232 interface is available as /dev/ttymxc2. In default configuration this interface will provide a Linux serial console at 115200 baud (8N1).
1-wire
The GW4100 incorporates a DS2482 I2C to 1-wire bridge device from Maxim Integrated (https://www.maximintegrated.com/en/products/interface/controllers-expanders/DS2482-100.html#). The corresponding driver is integrated in the Linux mainline kernel and all 1-wire functions are exposed to the sysfs filesystem.
Please see https://www.kernel.org/doc/html/latest/w1/w1-generic.html for a detailed description of the user space interface.
Digital inputs
The following diagram shows the internal design of the four digital inputs:
This design allows the connection of push-pull- and open-collector-outputs with a threshold of about 4.5V. It is also possible to use a mechanical switch or a relais to connect the input to GND without the need for an additional pullup resistor.
Following diagram shows a simplified design:
Please note that the input is inverted internally so that in case the input is either unconnected or connected to a voltage above the threshold will be read as logical 0 (low level), when connected to a voltage below the threshold (e.g. 0V) it will be read as logical 1 (high level)
The GPIs are exposed to the sysfs filesystem on the linux side an can be automatically inverted again for user conveniance.
TODO: add linux example
Multi-purpose I/O
The device contains two multi-purpose GPIOs which can be configured as in- or output. When required an internal pullup resistor can be activated.
Furthermore can the GPIO be used as an analog input as the input voltage is also connected to one of the internal 12-bit ADC channels (s. On board ADCs) .
The GPIO is current limited (tbd mA) in the high- and lowside current paths so closing high- and lowside switches at the same time will not damage the device (neither will an external short-circuit condition), it is nevertheless not advised to do so and use break-before-make logic instead.
TODO: add linux example
GSM
TE connectivity with fallback to 3G and 2G is provided by an integrated Quectel EC21 module. On the Linux side the device is controlled by ModemManager (see https://core.docs.ubuntu.com/en/stacks/network/modem-manager/docs/).
ModemManager uses /dev/ttyUSB3 for communication with the EC21, /dev/ttyUSB2 is available for AT command execution from user space.
The status of the GSM module can additionally be monitored by the means of GSM_PWR_IND_n which will be driven low when the module is on.
The GW4100 contains two SIM holders to allow the use of 2FF (Mini SIM) or 3FF (Micro SIM) cards. It is possible to populate both cards to allow e.g. the use of different networks. The active SIM card is selected by the following procedure.
SIM select procedure
First the EC21 has to be configured via AT commands to allow SIM hot-swapping:
((ABB))
Please note that a module restart by AT+CFUN is required, the setting will be persistent.
Next the SIM has to be “logically removed” by setting SIM_EN low.
Afterwards the active SIM can be selected by SIM_SEL (default high -> 2FF SIM)
Then the SIM can be “logically inserted” again by driving SIM_EN high
TODO: check if accessible old/new interface
Activating the data connection
The modem can then be used with:
root@Gateway:~ mmcli -m 0
--------------------------------
General | dbus path: /org/freedesktop/ModemManager1/Modem/0
| device id: dd1983f3c13bd25a19647d2fca076dad57ef5c57
--------------------------------
Hardware | manufacturer: Quectel
| model: EC21
| firmware revision: EC21EFAR06A02M4G
| supported: gsm-umts, lte
| current: gsm-umts, lte
| equipment id: 867962042149685
--------------------------------
System | device: /sys/devices/platform/soc/30800000.bus/30b30000.usb/ci_hdrc.1/usb1/1-1/1-1.1
| drivers: option1
| plugin: Quectel
| primary port: ttyUSB2
| ports: ttyUSB0 (qcdm), ttyUSB2 (at), ttyUSB3 (at)
--------------------------------
Numbers | own: +4915140075573
--------------------------------
Status | unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
| state: disabled
| power state: on
| signal quality: 0% (cached)
--------------------------------
Modes | supported: allowed: 2g, 3g, 4g; preferred: none
| current: allowed: 2g, 3g, 4g; preferred: none
--------------------------------
IP | supported: ipv4, ipv6, ipv4v6
--------------------------------
3GPP | imei: 867962042149685
--------------------------------
3GPP EPS | ue mode of operation: csps-2
--------------------------------
SIM | dbus path: /org/freedesktop/ModemManager1/SIM/0
After every reset the modem increases its number.
To add a new connection issue:
root@Gateway:~ nmcli c add type gsm ifname "*" con-name telekom apn "internet.t-mobile" Connection 'telekom' (17bdada4-4361-4eca-8506-f6eab6b26a48) successfully added.
And then to enable the connection:
root@Gateway:~ nmcli c up telekom
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
root@Gateway:~ mmcli -m 0
--------------------------------
General | dbus path: /org/freedesktop/ModemManager1/Modem/0
| device id: 794eb538900f787165b66d8af66496a4e7cd0c8b
--------------------------------
Hardware | manufacturer: QUALCOMM INCORPORATED
| model: QUECTEL Mobile Broadband Module
| firmware revision: EC21EFAR06A02M4G
| carrier config: default
| h/w revision: 10000
| supported: gsm-umts, lte
| current: gsm-umts, lte
| equipment id: 867962042149685
--------------------------------
System | device: /sys/devices/platform/soc/30800000.bus/30b30000.usb/ci_hdrc.1/usb1/1-1/1-1.1
| drivers: qmi_wwan, option1
| plugin: Quectel
| primary port: cdc-wdm0
| ports: cdc-wdm0 (qmi), ttyUSB0 (qcdm), ttyUSB2 (at), wwan0 (net),
| ttyUSB3 (at)
--------------------------------
Numbers | own: 4915140075573
--------------------------------
Status | lock: sim-pin2
| unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
| state: connected
| power state: on
| access tech: gsm
| signal quality: 41% (recent)
--------------------------------
Modes | supported: allowed: 2g; preferred: none
| allowed: 3g; preferred: none
| allowed: 4g; preferred: none
| allowed: 2g, 3g; preferred: 3g
| allowed: 2g, 3g; preferred: 2g
| allowed: 2g, 4g; preferred: 4g
| allowed: 2g, 4g; preferred: 2g
| allowed: 3g, 4g; preferred: 3g
| allowed: 3g, 4g; preferred: 4g
| allowed: 2g, 3g, 4g; preferred: 4g
| allowed: 2g, 3g, 4g; preferred: 3g
| allowed: 2g, 3g, 4g; preferred: 2g
| current: allowed: 2g, 3g, 4g; preferred: 4g
--------------------------------
Bands | supported: egsm, dcs, utran-1, utran-5, utran-8, eutran-1, eutran-3,
| eutran-5, eutran-7, eutran-8, eutran-20
| current: egsm, dcs, utran-1, utran-5, utran-8, eutran-1, eutran-3,
| eutran-5, eutran-7, eutran-8, eutran-20
--------------------------------
IP | supported: ipv4, ipv6, ipv4v6
--------------------------------
3GPP | imei: 867962042149685
| operator id: 26201
| registration: home
--------------------------------
3GPP EPS | ue mode of operation: csps-2
--------------------------------
SIM | dbus path: /org/freedesktop/ModemManager1/SIM/0
--------------------------------
Bearer | dbus path: /org/freedesktop/ModemManager1/Bearer/0
GNSS
For geo positioning a GNSS receiver integrated in the Quectel EC21 module is available. NMEA data is output on /dev/ttyUSB1. The GNSS receiver is activated with the following AT command:
AT+QGPS=1
For a detailed description of the available configuration options please consult the EC21 documentation (https://www.quectel.com/product/ec21.htm).
Active antenna supply is provided by regulator 9 of the Qorvo ACT8847 power management ic (PMIC). Following commands from user space are required to activate the supply:
# regulator 3.0V i2cset -y 2 0x5a 0x70 0x36 i # regulator on i2cset -y 2 0x5a 0x71 0x80 i
User LEDs
The device contains two user controllable LEDs (e.g. status signal). These are exposed to the sysfs under /sys/class/leds/. See Linux mapping for details.
please see https://www.kernel.org/doc/Documentation/leds/leds-class.txt for details.
User Button
There is a consealed button available for user defined functions (e.g. reset to factory default)
TODO: add linux example, picture
On board ADCs
The following diagram shows the usage of the eight 12-bit ADCs of the i.MX7D processor.
ADC 0 provides access to the voltage levels of the two multi-purpose GPIOs and the supply voltage as well as a board temperature indicator while ADC 1 is used to monitor system health status.
All ADC values are accessible from Linux user space via sysfs mapping (/sys/bus/iio/devices/).
Example 1: reading the actual value of the 5V supply lane
root@Gateway:~ cat /sys/bus/iio/devices/iio:device1/in_voltage0_raw 3789
Calculation of voltage:
Example 2: reading the system supply voltage
root@Gateway:~ cat /sys/bus/iio/devices/iio:device0/in_voltage2_raw 2145
Calculation of voltage:
Please note that measurement is taken behind the input diode and therefor the actual supply voltage is aprox. 0.5V higher (in this case the actual supply voltage is 24V)
Example 3: reading the board temperature
root@Gateway:~ cat /sys/bus/iio/devices/iio:device0/in_voltage3_raw 2576
Calculation of NTC resistance:
Consulting the resistance lookup table in the resistors (NCP15XV103J03RC) datasheet the board temperature is at about 37°C.
Linux mapping
Digital and analog I/Os (deprecated sysfs mapping)
| Signal | Linux mapping | Typ |
|---|---|---|
| GPI1 | /sys/class/gpio10 | digital inputs |
| GPI2 | /sys/class/gpio11 | |
| GPI3 | /sys/class/gpio14 | |
| GPI4 | /sys/class/gpio15 | |
| GPIO0_IN_n | /sys/class/gpio3 | Multi-purpose I/Os |
| GPIO0_ADC | /sys/bus/iio/devices/iio:device0/in_voltage0_raw | |
| GPIO0_HIGHSIDE | /sys/class/gpio0 | |
| GPIO0_LOWSIDE | /sys/class/gpio1 | |
| GPIO0_PULLUP | /sys/class/gpio2 | |
| GPIO1_IN_n | /sys/class/gpio9 | |
| GPIO1_ADC | /sys/bus/iio/devices/iio:device0/in_voltage0_raw | |
| GPIO1_HIGHSIDE | /sys/class/gpio4 | |
| GPIO1_LOWSIDE | /sys/class/gpio5 | |
| GPIO1_PULLUP | /sys/class/gpio8 | |
| LED_USR1 | /sys/class/leds/iotmaxx:green:usr1/ | LED B |
| LED_USR2 | /sys/class/leds/iotmaxx:green:usr2/ | LED A |
| PBSTAT_IRQ_n | /sys/class/gpio33 | PMIC PBSTAT IRQ |
| 5V_PERIPH_EN | /sys/class/gpio34 | N/A, always on |
| ACT8847_IRQ_n | /sys/class/gpio90 | PMIC IRQ |
| RTC_INTA_n | /sys/class/gpio61 | RTC IRQ |
| USR_SWITCH_n | /sys/class/gpio91 | User switch |
| SIM_ENABLE | /sys/class/gpio89 | SIM select |
| SIM_SEL | /sys/class/gpio112 | |
| CAN_TERM_EN_n | /sys/class/gpio108 | CAN termination resistor |
| GSM_PWR_IND_n | /sys/class/gpio115 | GSM power indicator |
Digital and analog I/Os (new libgpiod mapping)
| Signal | Linux mapping | line | Typ |
|---|---|---|---|
| GPI1 | gpiochip0 | line 10 | digital inputs |
| GPI2 | gpiochip0 | line 11 | |
| GPI3 | gpiochip0 | line 14 | |
| GPI4 | gpiochip0 | line 15 | |
| GPIO0_IN_n | gpiochip0 | line 13 | Multi-purpose I/Os |
| GPIO0_ADC | /sys/bus/iio/devices/iio:device0/in_voltage0_raw | ||
| GPIO0_HIGHSIDE | gpiochip0 | line 0 | |
| GPIO0_LOWSIDE | gpiochip0 | line 1 | |
| GPIO0_PULLUP | gpiochip0 | line 2 | |
| GPIO1_IN_n | gpiochip0 | line 9 | |
| GPIO1_ADC | /sys/bus/iio/devices/iio:device0/in_voltage1_raw | ||
| GPIO1_HIGHSIDE | gpiochip0 | line 4 | |
| GPIO1_LOWSIDE | gpiochip0 | line 5 | |
| GPIO1_PULLUP | gpiochip0 | line 8 | |
| LED_USR1 | /sys/class/leds/iotmaxx:green:usr1/ | LED B | |
| LED_USR2 | /sys/class/leds/iotmaxx:green:usr2/ | LED A | |
| PBSTAT_IRQ_n | gpiochip1 | line 1 | PMIC PBSTAT IRQ |
| 5V_PERIPH_EN | gpiochip1 | line 2 | N/A, always on |
| ACT8847_IRQ_n | gpiochip2 | line 26 | PMIC IRQ |
| RCT_INTA_n | gpiochip1 | line 29 | RTC IRQ |
| USR_SWITCH_n | gpiochip2 | line 27 | USER switch |
| SIM_ENABLE | gpiochip2 | line 25 | SIM select |
| SIM_SEL | gpiochip3 | line 16 | |
| CAN_TERM_EN_n | gpiochip3 | line 12 | CAN termination resistor |
| GSM_PWR_IND_n | gpiochip3 | line 19 | GSM power indicator |
GPIO Linux user space examples (deprecated sysfs mapping)
Example: exporting and reading GPIN1 (high level applied to input pin)
root@Gateway:~ echo 11 > /sys/class/gpio/export root@Gateway:~ echo 1 > /sys/class/gpio/gpio11/active_low root@Gateway:~ cat /sys/class/gpio/gpio11/value 1
Example: exporting and enabling GPIO1 pullup
root@Gateway:~ echo 8 > /sys/class/gpio/export root@Gateway:~ echo high > /sys/class/gpio/gpio8/direction
Please see https://www.kernel.org/doc/html/latest/admin-guide/gpio/sysfs.html for a detailed description of the sysfs gpio interface.
GPIO Linux user space examples (new libgpiod mapping)
Example: reading GPIN1 (high level applied to input pin), no export required
root@Gateway:~ gpioget --active-low gpiochip0 11 1
Example: enabling GPIO1 pullup, no export required
gpioset gpiochip0 8=1
Please see https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/README for a description of the libgpiod interface.
Serial interfaces and busses
| Interface or bus | Linux mapping | |
|---|---|---|
| RS232 | /dev/ttymxc2 | linux console |
| RS485 | /dev/ttymxc3 | |
| 1-wire | /sys/bus/w1/ | see kernel.org |
| CAN | can0 network interface | |
| Ethernet | eth network interface | |
| USB | device dependent |



