-
Notifications
You must be signed in to change notification settings - Fork 15
TLV Library and Scripts
All the Sparrow devices, including the Yanzi 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 tools/sparrow
.
The TLV library is used for all the discovery scripts, set/read scripts and the demo software. This library implements the Sparrow TLV and Encap (encapsulation) protocols.
The TLV scripts are stored in the folder tools/sparrow
.
TLV Discovery
For performing a discovery of the device functional instances use the script
tools/sparrow/tlvdiscovery.py
that takes an IP address as argument (either IPv4 or IPv6).
> tools/sparrow/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.
Instance 1: type: 0090da0303010010 Primary firmware
Version: 0090da028fc0ef40 untagged-20160715 inc: 0
Image Type: 70b3d57d51000001 Status: upgradable
Instance 2: type: 0090da0303010010 Backup firmware
Version: 0090da028fc0ef41 untagged-20160715a inc: 1
Image Type: 70b3d57d51000001 Status: active
The tools/sparrow/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 act as a radio packet sniffer. When sniffing it will produce a PCAP file with all radio packets it hears and this file can be imported in Wireshark.
> tools/sparrow/sniff.py -t 15 -o capture.pcap
Configuring radio for sniffing (border router 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 with the PCAP data.
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 and send the data to Wireshark.
> tools/sparrow/sniff.py -s | wireshark -k -i -
The Python script tools/sparrow/tlvupgrade.py
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.