Professional Documents
Culture Documents
TI G3 DC Interface Guide
TI G3 DC Interface Guide
Version 1.5
July 31, 2015
Copyright Texas Instruments Incorporated, 2011-2015
The information and/or drawings set forth in this document and all rights in and to
inventions disclosed herein and patents which might be granted thereon disclosing or
employing the materials, methods, techniques, or apparatus described herein are the
exclusive property of Texas Instruments. No disclosure of information or drawings shall
be made to any other person or organization without the prior consent of Texas
Instruments.
1.0 INTRODUCTION................................................................................................. 5
2.0 TI G3 DC INTERFACES ..................................................................................... 6
3.0 MESSAGE FORMAT .......................................................................................... 7
3.1 MESSAGE HEADER FORMAT.................................................................................. 7
3.2 MESSAGE PAYLOAD FORMAT ............................................................................... 8
4.0 IPV6 APPLICATION INTERFACE .................................................................. 9
4.1 EXAMPLE IPV6 EXTERNAL APPLICATION ............................................................. 10
5.0 MANAGEMENT INTERFACE ........................................................................ 13
5.1 EXAMPLE EXTERNAL MANAGEMENT APPLICATION .............................................. 13
5.1.1 ?................................................................................................................... 14
5.1.2 ctrl-c ............................................................................................................ 14
5.1.3 q................................................................................................................... 14
5.1.4 get-dc-std..................................................................................................... 14
5.1.5 get-dc-ver .................................................................................................... 14
5.1.6 get-dc-dsp-ver ............................................................................................. 16
5.1.7 get-mac-node-info ....................................................................................... 16
5.1.8 detach-node ................................................................................................. 16
5.1.9 discover-path............................................................................................... 16
5.1.10 discover-route ............................................................................................. 16
5.1.11 get-adp-ib .................................................................................................... 17
5.1.12 set-adp-ib .................................................................................................... 17
5.1.13 get-mac-ib ................................................................................................... 17
5.1.14 set-mac-ib .................................................................................................... 17
5.1.15 set-psk ......................................................................................................... 18
5.1.16 set-gmk ........................................................................................................ 18
5.1.17 cfg-dc........................................................................................................... 18
5.1.18 rekey-nwk .................................................................................................... 20
5.1.19 set-phy-tx-params ....................................................................................... 20
5.1.20 discover-net ................................................................................................. 20
5.1.21 start-net ....................................................................................................... 21
5.1.22 get-route-table............................................................................................. 21
5.1.23 get-neighbor-table....................................................................................... 21
5.1.24 get-device-table ........................................................................................... 21
5.2 MANAGEMENT INTERFACE MESSAGE SEQUENCE ................................................ 23
5.2.1 Show active nodes ....................................................................................... 23
5.2.2 Detach Node................................................................................................ 23
6.0 EVENT MESSAGE INTERFACE ................................................................... 24
6.1 EXAMPLE EXTERNAL EVENT MONITOR APPLICATION........................................... 24
7.0 PSK SERVER INTERFACE ............................................................................. 25
7.1 DEFAULT EXAMPLE PSK SERVER........................................................................ 25
7.2 PSK SERVER INTERFACE MESSAGE SEQUENCE................................................... 26
7.2.1 Get PSK from EUI ...................................................................................... 26
REFERENCE .................................................................................................................. 27
1.0 Introduction
The G3 DC allows external applications to communicate with the nodes (meters) in its
network. The G3 DC runs on an IPv4/IPv6 addressable system. The external application
can run anywhere as long as it has TCP/IPv4 connectivity to the G3 DC.
PSK Server
Buffer Manager
Upper MAC
Management
HCT Server
Linux OS
UART Interface
(HCT message)
C2000 (F28069 SOM board)
HCT
Buffer Manager
Lower MAC
PHY
HAL
DSP-BIOS
2.0 TI G3 DC Interfaces
The TI G3 Data Concentrator (DC) software package supports the following interfaces:
Management Interface
o Network management
Nodes information
Route/Path
Event notifications
PSK Server
o EUI PSK management
3.0 Message Format
Figure 1 shows the format of messages exchanged by the Mgmt entity and G3 DC. All
multi-byte values are sent in network byte order.
Message
Message Body
Header
0 1 Message Type
Field Description
Message Type Message Type identifier.
DIR Direction of the message. Client -> DC (1) / DC -> Client (0).
LFF Length field flag. If bit is 1, all length fields (message header and body) are 4
bytes in size. If bit is 0, all length fields (message header and body) are 2
bytes in size.
Message Payload A 16 bit number representing the length of the message payload.
Length
Figure 3 Message Header Fields Description
3.2 Message Payload Format
The message payload is sent in the TLV (type, length and value) format. The message
payload has a single top level TLV which can contain can have any number of TLVs
each of which can be simple or compound. In other words, each TLV in the payload must
be encapsulated within a parent TLV except for the top level TLV.
If the LFF bit in the message header is 1, for every TLV included in the message, the
TLV length field value field is 4 bytes in size. If the LFF bit in the message header is 0,
for every TLV included in the message, the TLV length field value field is 2 bytes in
size.
Message payloads in this document are described in a format similar to the one shown
below:
<Optional/Mandatory>
TLV level: 0
TLV type: X0
TLV length field value: Variable/Fixed
TLV count: 1
<Mandatory>
TLV level: 2
TLV type: X2
TLV length field value: Variable/Fixed
TLV count: Variable/Fixed
The “level” information shows the depth of the TLV from the top most TLV in the
payload. Level 0 refers to the top most TLV itself. The “count” information shows the
number of TLVs of the same type allowed at a specific level. For example, there can be
only one top level TLV but there can be any number of
“MGMT_TLV_TYPE_ACTIVE_NODE_INFO” TLVs at level 1 (one for each active
node in the G3 network). Finally, any TLV is optional or mandatory. A TLV is optional
if it may or may not be included when its parent is included in the payload. A TLV is
mandatory if the TLV should always be included when its parent is included in the
payload.
4.0 IPv6 Application Interface
The G3 DC allows external applications (using UDP/IPv6) to communicate with the
nodes (meters) in its network. The G3 DC creates a virtual network device “tun0” on the
OMAP L138 and assigns a link local IPv6 address to it. This link local address is derived
from the G3 PAN Id and DC’s short address (0x0000). All G3 nodes (meters) use the
IPv6 stateless auto-configuration mechanism to self assign a link local address based on
the G3 PAN Identifier and short address (allocated by the DC). This “tun0” interface is
the gateway to the G3 network. External apps can only be run on the OMAP L138 board
since the G3 network uses link local addresses only.
You can look at the “tun0” interface by running the Linux “ifconfig” command. The IPv6
address will look like “fe80::<pan-id>:00ff:ffee:0000. If the PAN Identifier is 0x7455,
the IPv6 address will be “fe80::7455:00ff:ffee:0000.
A node with short address 0x1234 will assign itself the IPv6 address
“fe80::7455:00ff:ffee:1234”.
When an app sends a packet to a node in the G3 network, the packet will be sent by the
IPv6 layer (on the OMAP L138) to the tun0 interface. The tun0 interface will send it to
the G3 DC which in turn will send it over the power line. UDP/IPv6 packets received by
the DC over the power line will be written to the tun0 interface which will forward them
to the IPv6 layer which in turn will send them to application (running on the OMAP
L138) bound to the specified destination UDP port number.
Overloading Type of Service field for MSDU handle and LQI Indication:
The Type service field is used by IPv6 to indication the priority of the IPv6
frames. Two allowed values are: 0x20 (High Priority) and 0x00 (Normal Priority). This
implies that the priority is based on only one of the eight bits.
The remaining 7 bits are overloaded to represent the MSDU handle and LQI value in the
direction towards and away from DC.
The following illustrates the conversion between the MSDU handle to ToS bit in IPv6
packet.
From the 7-bit handle to the 7 bits of TOS:
tosbits = (MSDUHandle & 0x1F) | ((MSDUHandle << 1) & 0xC0);
Note that if no such value is specified, that is all zeros are used for this field like in
regular Ipv6 frames, the MSDU handle shall also be only zero. This would allow the host
to continue to use existing IPv6 applications like PING6.
Similarly, when a IPv6 frame is received from the TUN interface to the application, these
7 bits are overloaded to represent the LQI value (0 to 127). The mapping between the
IPv6 to LQI is as follows:LQI = ((tosbits >> 1) & 0x60) | (tosbits & 0x1F);
Since the prefix table entry could match multiple source IP addresses based on the length
of the prefix, the application is expected to add a specific source IP addresses depending
on the requirement. This can be achieved by configuring the linux system command:
ip -6 addr add <IP address>/<prefix len> dev tun0
You can compile this application for the OMAP L138 platform by running “make”
without any arguments.
This application “udpIPv6App” takes multiple command line arguments as shown below:
udpIPv6App \
-l <pkt length> \
-s <dest short address (hex)> | -b | -m <13 bit multicast group id> \
-p <pan Id (hex)>] \
[-u <dest UDP port>] \
[-t <response time out in seconds>]
-l <pkt length>
This argument is used to specify the length of the data packet which will
be sent to the specified service node.
-b
This argument is used to request a broadcast transmission using the all
node multicast destination address ff02 :: 01.
-m
This argument is used to request a multicast transmission to the specified
group. The multicast group is identified by a 13 bit group id. Assuming
the 13 bit multicast group id is ‘0xabcd’, the app sends a packet to the
IPv6 multicast address ff02 :: (0x8000 | 0xabcd).
Example:
Prompt>./udpIPv6App -l 32 -s 0x0102
Prompt>./udpIPv6App -l 32 –b
Prompt >./udpIPv6App -l 32 –m 0x5
Opens an IPv6/UDP socket. Uses the “tun0” virtual network device created by
the G3 DC.
If user has requested unicast transmission, sends a single data packet of specified
length to specified service node. If user has requested broadcast transmission,
sends a single packet to the all node multicast address ff02 :: 01. If user has
requested multicast transmission, sends a single packet to the multicast address
ff02 :: (0x8000 | 0xabcd) where 0xabcd is the specified 13 bit multicast address.
Waits specified time (in seconds) for destination to loop back the data.
If a unicast packet was sent, the app will exit at this point. If a multicast or
broadcast packet was sent, app will wait for more packets. You need to use ctrl-c
to kill the app in this case. Note that G3 service nodes in embedded appemu mode
will loop back a multicast / broadcast packet to the unicast address of the source.
This means a network with ‘N’ nodes (in embedded appemu mode ) will in theory
generate ‘N - 1’ unicast responses to a broadcast packet. Similarly a G3 network,
which has ‘M’ members in a multicast group (0xabcd), will generate ‘M - 1’
unicast responses to a multicast packet sent to the group ‘0xabcd’, assuming all
these member nodes are in embedded appemu mode.
5.0 Management Interface
The G3 DC allows external applications “sw\g3_mgmt_cli” to communicate with it.
Some messages are for getting specific information from the DC while others are
commands to be executed by the DC.
The G3 DC runs on an IPv4/IPv6 addressable system. The external application can run
anywhere as long as it has TCP/IPv4 connectivity to the G3 DC.
The G3 DC includes a MGMT server which accepts TCP connections on the default port
number 20000. Use the ‘-m’ option when starting the G3 DC to specify another port
number.
For additional details on the message types and TLV structures used in the Management
interface, please refer to the doc “TI PLCSUITE G3 DC MGMT INTF MSG”.
You can build this application for the ARM9 platform by running the command “make”.
Then to run, you will have to transfer the executable to the ARM9 filesystem.
To run the CLI client, go to the directory where the g3_mgmt_cli executable resides on
the ARM9 filesystem. Execute the application without any arguments.
target# ./g3_mgmt_cli
Connecting to 127.0.0.1:20000
Connected…
>>
You can use the “?” command to get a list of all implemented commands. You can also
get more help on a specific command using the “?” argument.
For example:
>> discover-route ?
discover-route –da <16-bit short addr>
Parameters: None
Returns: List of all commands
Example:
>> ?
get-dc-std
get-dc-ver
get-dc-dsp-ver
get-mac-node-info
detach-node
discover-path
discover-route
get-adp-ib
set-adp-ib
get-mac-ib
set-psk
set-gmk
cfg-dc
rekey-nwk
set-phy-tx-params
discover-net
start-net
5.1.2 ctrl-c
Parameters: None
Description: Exit the CLI
5.1.3 q
Parameters: None
Description: Exit the CLI
5.1.4 get-dc-std
Parameters: None
Description: Get the DC type (PRIME or G3)
5.1.5 get-dc-ver
Parameters: None
Description: Get the DC software version
5.1.6 get-dc-dsp-ver
Parameters: None
Description: Get the DC DSP software version
5.1.7 get-mac-node-info
Parameters: None
Description: G3 DC PAN ID and list of attached nodes. Each node is identified by its
short address and extended.
Example:
5.1.8 detach-node
5.1.9 discover-path
5.1.10 discover-route
5.1.11 get-adp-ib
5.1.12 set-adp-ib
5.1.13 get-mac-ib
5.1.14 set-mac-ib
5.1.15 set-psk
5.1.16 set-gmk
Note: To activate this key in MAC use set-adp-ib command in management cli to set
GMK index. (ADP PIB id 0x90)
Note: This will not be supported from 4.2 version. New GMK Keys can be set along with
their Ids using the rekey command.
5.1.17 cfg-dc
To run G3 DC (in non-AES mode) with silent reboot functionality and node list recovery
>> cfg-dc –srf ena –snal /tmp/nl
Success
To run G3 DC (in AES mode) with silent reboot functionality and node list recover
>> cfg-dc –srf ena –mfcth 25 –smfc 103 –snal /tmp/nl
Success
To use silent restart option with cfg-dc command, the following parameters need to be
configured:
1) SN address table: input by txt file
a. DC needs to maintain SN table (for long-address and short-address) based on
ATTACH/DETACH events.
b. As an example, the txt file includes the following formatted context:
<00.00.00.00.00.00.00.06:0002>
<00.00.00.00.00.00.00.01:0005>
….
Here is an example of parameters to be set when using silent restart option with cfg-dc
command.
Initial After restarting
NOTE: Please note in case of Silent DC reboot ,if the CoordShortAddress( LBS) short
address was non – zero before restart , the CoordShortAddress PIB (0x01000107) would
need to be explicitly set on the DC restart after the cfg-dc command .
5.1.18 rekey-nwk
5.1.19 set-phy-tx-params
5.1.20 discover-net
5.1.21 start-net
5.1.22 get-route-table
Parameters: None
Description: Get the route table.
Example:
>> get-route-table
5.1.23 get-neighbor-table
Parameters: None
Description: Get the neighbor table. Example:
>> get-neighbor-table
5.1.24 get-device-table
Parameters: None
Description: Get the RX device table.
Example:
>> get-device-table
5.2 Management Interface Message Sequence
The diagram below shows the message sequence between the Management interface and
TI G3 DC.
Mgmt CLI TI G3 DC
G3_SHOW_ACTIVE_NODES
MGMT_TLV_TYPE_ACTIVE_
NODE_INFO_LIST
Mgmt CLI TI G3 DC
G3_DETACH_NODE
Un-register node
G3_DETACH_NODE
confirmation
6.0 Event message interface
The G3 DC generates events messages in response to G3 network events such as node
attach and node detach. If an external app establishes a connection to TCP port 45000,
the DC will send event messages to this external app over the TCP connection. Note that
events will be sent to only one external app. For additional details on the message types
and TLV structures used over the events interface, please refer to the doc “TI PLCSUITE
G3 DC MGMT INTF MSG”.
You can build this application for the ARM9 platform by running the command “make”.
Then to run, you will have to transfer the executable to the ARM9 file system.
To run the event client, go to the directory where the g3_evt_mon executable resides on
the ARM9 filesystem. Execute the application without any arguments.
target# ./g3_evt_mon
Connecting to 127.0.0.1:45000
Connected…
>>
7.0 PSK Server interface
The G3 DC generates a request for a PSK for each EUI joining the network. The request
is sent to a PSK Server, which maintains a EUI/PSK pair. The default PSK Server
(psksvr_omap for the OMAP_L138 platform, psksvr_AM335X for the AM335X
platform or psksvr for the X86 platform) is loaded automatically by the G3 DC provided
another PSK Server IP Address has not been provided to the G3 DC.
When the server node is attempting to join the network, the G3 DC will ask the PSK
Server to supply the PSK for the service node by supplying the service node EUI address
to the PSK Server. The PSK Server will respond to the G3 DC supplying the requested
PSK. Additionally, the PSK Server can reject the request by responding to the G3 DC's
request with an unsuccessful status code.
Optionally, the PSK Server can assign the short address and return the short address to
the DC with the PSK. If the DC is to assign the short address as it has in prior releases,
then the PSK Server will not return a short address when returning the EUI/PSK pair.
For additional details on the message types and TLV structures used over the PSK Server
interface, please refer to the doc “TI PLCSUITE G3 DC MGMT INTF MSG”.
The TI PSK Server listens for connections through TCP port number 30001 and accepts
any connection request. After the G3 DC connects to the PSK Server, the PSK Server
can be queried for the PSK of the given service node EUI address. The PSK Server
always returns a status code indicating the status of the request. The status code value 0
(zero) indicates the PSK is given for the EUI, otherwise the PSK is not returned and the
status code indicates the reason, which can be error, EUI not found in the white list, etc.
The TI PSK Server can either supply the TI default PSK for all EUI nodes, which is the
prior G3 DC operation, or can read a file containing EUI/PSK pairs and return
individualized PSK for each service node. The EUI/PSK whitelist file is named
pskeuilist. The pskeuilist file contains records of EUI/PSK pairs, one pair per line, each
line terminated with a new line character '\n'. The EUI/PSK pair contains the EUI and
PSK in hexadecimal, each octet separated with a hyphen '-'. The following is an example
pskeuilist file:
80-00-00-00-00-00-00-01 00-11-22-33-44-55-66-77-88-99-aa-bb-cc-dd-ee-ff
80-00-00-00-00-00-00-02 00-11-22-33-44-55-66-77-88-99-aa-bb-cc-dd-ee-10
80-00-00-00-00-00-00-03 00-11-22-33-44-55-66-77-88-99-aa-bb-cc-dd-ee-10
If the EUI/PSK whitelist file pskeuilist does not exist in the same directory as the TI PSK
Server, the default PSK will be used for each EUI request.
The TI PSK Server does not optionally assign the short address.
You can build this application for the ARM9 platform by running the command “make”.
Then to run, you will have to transfer the executable to the ARM9 file system.
The diagram below shows the message sequence between the PSK Server interface and
TI G3 DC.
PSK SVR TI G3 DC
G3_GET_PSK_FROM_EUI
G3_GET_PSK_FROM_EUI
response
Reference
[1]. TI PLC Kit-V3: http://focus.ti.com/docs/toolsw/folders/print/tmdsplckit-v3.html
[2]. PLC G3 MAC Layer Specification
[3]. PLC G3 PHY Layer Specification