Vidíte historickú verziu tejto stránky. Pozrite si aktuálnu verziu.

Porovnať s aktuálnou verziou Zobraziť históriu stránky

« Predchádzajúce Verzia 4 Ďalej »

GPIO protocol


Supported device types and versions
Communication line configuration
Communication station configuration
I/O tag configuration
Literature
Changes and modifications
Document revisions


Supported device types and versions


Protocol supports communication via GPIO (General Purpose I/O) interface on Raspberry PI and computers built on a RPI Compute Module. Currently supported are:

  • Raspberry PI (version 2 and 3) based on pigpio library
  • Techbase NPE-X500 M3  (DIN-mounted industrial computer built on RPI Compute Module 3 with optional industrial inputs and outputs)

The communication was tested with Raspberry PI (version 3) and NPE-X500-M3-MAX-3G.

The protocol allows reading of digital and analog inputs (in case of NPE-X500 also a value of user button), writing to digital outputs (for NPE-X500 also setting relay outputs, working with user LEDs and a buzzer).

Communication line configuration



  • communication line category: API.
  • By default, a single line with a single station is configured for one device. If there is a need to stop communication with selected inputs/outputs, there may be several stations on one line. Due to the load distribution or for the rapid reading of the digital inputs, several lines with one or more stations per-line can be configured.


Communication line parameters


Communication line - configuration dialog box - the Protocol parameter tab.
Parameters defined in the field have effect on some optional protocol parameters. There can be defined the following line protocol parameters:


Table 1

Full nameDescriptionUnits / sizeDefault value

Device Type

Type of device. Currently supported are::

  • Raspberry PI
  • NPE-X500


-Raspberry PI

Library Name

Name of library with communication functions for a particular device. The used values are:

  • libpigpio.so for Raspberry PI
  • libx1000gpio.so for NPE-X500
--

Read Delay Ms

Delay after one reading of the values of all I/O tags. Using this parameter, it is possible to control the reading frequency more finely than using the polling parameters in the configuration of time parameters of the station.

ms

1

Communication station configuration



  • Communication protocol: GPIO Protocol.
  • Station address: n/a.


I/O tag configuration



Possible I/O tag types: Ai, Ao, Ci, Co, Di, Do.


The address format of the I/O tag depends on the device type.

I/O tag addresses for Raspberry PI

In the following table, id defines the number of ping in BCM (Broadcom) numbering.

Following image copied from http://pinout.xyz shows the BCM pin numbering on the GPIO connector:

Obrázok prevzatý z http://pinout.xyz zobrazuje BCM číslovanie pinov na GPIO konektore


AdresaPopisTyp boduPríklady

DI,id
DI_UP,id
DI_DOWN,id

GPIO pin bude nakonfigurovaný ako digitálny vstup. Ak bude naň privedené napätie 3.3V, hodnota vstupu bude 1. Ak bude naň privedené napätie 0V (zem), hodnota vstupu bude 0.
Varianty DI_UP a DI_DOWN konfigurujú vnútorné pull-up resp. pull-down rezistory, takže na vstup je cez rezistor pripojené napätie (DI_UP) alebo zem (DI_DOWN), takže aj bez pripojenia externého napätia je vstup v definovanom stave. Varianta DI konfiguruje pin tak, že pull-up/pull-down odpory sú odpojené.
Di, Ci, AiDI,25
DI_UP,24

DO,id

GPIO pin bude nakonfigurovaný ako digitálny výstup. Ak bude doň zapísaná hodnota 1, na výstupe bude napätie 3.3V. Ak bude doň zapísaná hodnota 0, na výstupe bude napätie 0V (zem).

Dout, Co, Ao

DO,24

PWM,idGPIO pin bude nakonfigurovaný ako PWM (pulse width modulation) výstup. Následne je doň možné zapisovať hodnoty 0-255 riadiace šírku impulzu od úplne vypnutého až po úplne zapnutý.Dout, Co, AoPWM,12
REVISON

Hodnota revízie hardvéru (číslo z riadku "Revision" zo súboru /proc/cpuinfo. Napr. pre RPI 3 je v tomto súbore riadok "Revision        : a02082" a hodnota revízie (po prevode z hexadecimálneho tvaru) je 10494082.

CiREVISON






I/O tag addresses for NPE-X500

In the following table, id defines the number of input/output (e.g. DI, DO, AO). The number of inputs and outputs depends on the particular model. The notes are referring to the NPE-X500-M3-MAX-3G that was tested.
Note 1: Output points whose addresses contain _BUF use a buffered writing. This allows the values of such objects not only to be written, but also to be read, which can be useful, for example, after the start of the KOM process.
Note 2: With the tested model, the reading of the digital input took less than 1 ms, while the reading the analog input took approximately 20 ms.

AddressDescriptionI/O tag type

Examples

DI,id

Digital input (DI)
Note: The tested device under had inputs DI1-DI4. The value 0 means that the input is connected to the ground, the value 1 means that the input is disconnected from the ground and has a 3.3 V voltage supplied by the device.

Di, Ci, AiDI,1
DI,2

DO,id
DO_BUF,id

Digital output (DO). If buffered (DO_BUFF), the value is also read (during startup and periodically).
Note: The tested device had open collector outputs DO1-DO4, i.e. by writing the value 1 the output is connected to the ground.

Dout, Co, Ao

DO,1
DO_BUF,4

DIO,id
DIO_BUF,id

Digital input/output. Based on I/O tag type, the GPIO port is configured as input (Di, Ci, Ai) or output (Dout, Co, Ao).
If the I/O tag configured as output is also buffered (DIO_BUFF), the value is also read (during startup and periodically).
Note: The device tested had digital inputs/outputs DIO1-DIO4 configurable in pairs (i.e., 1 and 2 resp. 3 and 4 must be configured the same way - as input or output).

Input: Di, Ci, Ai
Output: Dout, Co, Ao
DIO,2
DIO_BUF,3
RELAY,id
RELAY_BUF,id

Relay output. If buffered (RELAY_BUFF), the value is also read (during startup and periodically).
Note: The tested device did not have any relay outputs, so this functionality is not tested.

Dout, Co, AoRELAY,1
RELAY_BUF,2
AI,id

Analog input (AI).
Note: The tested device had analog inputs AI1-AI4 with 12-bit A/D converters that converted the input voltage 0-10 V to a number 0-4095.

Ci, Ai

AI,1
AI,3

LED,id
LED_BUF,id

LED output. If buffered (LED_BUFF), the value is also read (during startup and periodically).
Note: the tested device had two LEDs (red LED,1 and green LED,2) that lighted up after writing 1 and went out after writing 0.

Dout, Co, AoLED,1
LED_BUF,2
BUZZER
BUZZER_BUF

Buzzer. If buffered (BUZZER_BUFF), buzzer status is also read (during startup and periodically).
Note: The tested device had a buzzer that started to output a tone after writing 1 and became silent after writing 0.

Dout, Co, AoBUZZER
BUZZER_BUF
BUTTON
BUTTON_BUF

User button status.
Note: The tested device had a button that behaved like a DI - it had normally value of 1 and when pressed, had value of 0.

Di, Ci, AiBUTTON



Literature



Changes and modifications





Document revisions



  • Ver. 1.0 - August 30th, 2018 – Document created


  • Žiadne štítky