Skip to content

TLV Library and Scripts

Joakim Eriksson edited this page Jun 9, 2016 · 6 revisions

All the Sparrow devices, including the IoT-U10 or Zolertia Re-Mote running Sparrow, make use of the Sparrow application layer which enable resource discovery and other things - including firmware upgrade over the air (OTA). The tools and scripts available for accessing the Sparrow application layer are available in XYZ.

TLV library

For all the discovery scripts, set/read scripts and the demo software the TLV library is used. This library implements the TLV and Encap (encapsulation) protocols.

TLV Scripts

The TLV scripts are stored in the XYZ folder.

TLV Discovery

For performing a discovery of the device functional instances use the script tlvdiscovery.py that takes a IP address as argument (either IPv4 or IPv6).

 > tlvdiscovery.py fd00::212:4b00:60e:daa
 HOST:  fd00::212:4b00:60e:daa
 Product label: iot-u10+  type: 0090da0301010500  instances: 6
 Booted at: 2015-04-20 16:16:24 - 1 min 12 sec 508 msec
 Instance 1: type: 0090da0303010010   Primary firmware
 Instance 2: type: 0090da0303010010   Backup firmware
 Instance 3: type: 0090da0302010019   Temperature
      	Temperature: 33.75 (C)
 Instance 4: type: 0090da030201001e   LEDs
     leds are set to 0x00 (2 user leds)
 Instance 5: type: 0090da030201001d   Button
     button is not pressed, has been pressed 0 times
 Instance 6: type: 0090da0303010023   Network stats
     Version: 0 		Capabilities: 0x700
     Push period: 0 sec	Remaining: 0 sec	To port: 0
     RPL Rank: 512  Churn: 0  Free neighbors: 19  Free routes: 20
     Default route: 0x060e0b80  link-metric: 256  rank: 256

The result of running TLV Discovery is a complete list of the functional instances with their type and label plus some of the variables automatically read by the script.

If the tlvdiscovery.py is run with the argument -v, it will show more verbose information including the version of the installed firmwares and which firmware is currently running.

Radio Sniffer

The sniff.py script requires a Sparrow Border Router to be running with a Sparrow Serial Radio and it can re-configure the serial radio to perform radio packet sniffing. When sniffing it will produce a PCAP file with all radio packets it hears and this file can be imported in Wireshark.

 > tools/yanzi/sniff.py -t 15
 Configuring radio for sniffing. (SBR will not work during capture)
 Capturing  capture.pcap

This will run the packet sniffer for 15 seconds. After this there will be a file capture.pcap in the current directory. It is also possible to save the PCAP to another file using the argument -o filename.

The radio sniffer can also send the radio packets directly to Wireshark in real time instead of first saving the data to a file. This will run the radio sniffer for 320 seconds and send the data to Wireshark.

> tools/yanzi/sniff.py -s -t 320 | wireshark -k -i - 

Note: if you kill the sniff.py script before it is done, the serial radio might remain in radio sniffer mode and no longer work as normal router. If this happens, simply run the sniff.py script again and let it finish.

TLVUpgrade

The TLVUpgrade tool is a Java program that is used for sending full firmware images to the nodes in order to upgrade the complete software of the node. See the upgrade page for more information how to upgrade the software on nodes.