Lantronix XPort XChip - User Guide - Page 71

Control Protocol, Guidelines, Commands

Page 71 highlights

9: GPIO Interface Control Protocol The GPIO control protocol is a simple, proprietary protocol. Command 0 Guidelines The GPIO control protocol is described from the PC side. Send means from PC to XPort. Response comes from XPort to PC. The protocol allows for control of up to 32 GPIOs. How many are actually available depends on the product. XPort has only three. The parameters are four bytes long and represent GPIOs 0-31, with GPIO0 in bit 0 of the first byte (Little Endian). Parameter bits for configurable pins not configured as GPIOs are undefined for Get commands and ignored on Set commands. Every command consists of nine bytes: one command type of one byte and two parameters of four bytes each. Parameter 1 Parameter 2 1 2 3 4 5 6 7 8 On some commands, one or all parameters are ignored. For UDP, command type and parameters need to be in the same datagram. Responses to valid commands are always five bytes long, consisting of the returned command byte and as parameters in the current or updated values. In case of an invalid command, only one byte with value 0FFh is returned. Command Parameter 1 0 1 2 3 4 When sending a command (TCP and UDP), wait for the response before sending the next command. Commands Byte 0 Command Types 10h Get functions 11h Get directions (input or output) 12h Get active levels (high active or low active) 13h Get current states (active or not active) 19h Set directions 1Ah Set active levels 1Bh Set current states There is no Set functions command. Since the pin's function depends on the hardware in which the XPort is embedded, that configuration is only allowed using 77FE. Settings changed by any of the Set commands are not stored and are lost when the unit is powered down or rebooted. XPort User Guide 71

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87

9: GPIO Interface
Control Protocol
The GPIO control protocol is a simple, proprietary protocol.
Guidelines
The GPIO control protocol is described from the PC side. Send means from PC to
XPort. Response comes from XPort to PC.
The protocol allows for control of up to 32 GPIOs. How many are actually available
depends on the product. XPort has only three.
The parameters are four bytes long and represent GPIOs 0-31, with GPIO0 in bit 0 of
the first byte (Little Endian). Parameter bits for configurable pins not configured as
GPIOs are undefined for
Get
commands and ignored on
Set
commands.
Every command consists of nine bytes: one command type of one byte and two
parameters of four bytes each.
Command
Parameter 1
Parameter 2
0
1
2
3
4
5
6
7
8
On some commands, one or all parameters are ignored.
For UDP, command type and parameters need to be in the same datagram.
Responses to valid commands are always five bytes long, consisting of the returned
command byte and as parameters in the current or updated values. In case of an
invalid command, only one byte with value 0FFh is returned.
Command
Parameter 1
0
1
2
3
4
When sending a command (TCP and UDP), wait for the response before sending the
next command.
Commands
Byte 0 Command Types
10h
Get functions
11h
Get directions (input or output)
12h
Get active levels (high active or low active)
13h
Get current states (active or not active)
19h
Set directions
1Ah
Set active levels
1Bh
Set current states
There is no
Set functions
command. Since the pin’s function depends on the
hardware in which the XPort is embedded, that configuration is only allowed using
77FE. Settings changed by any of the
Set
commands are not stored and are lost
when the unit is powered down or rebooted.
XPort User Guide
71