# No Free Lunch--Characterizing the Performance of 6 TiSCH When Using Different Physical Layers
## 4 A PHY-Layer Agile Extension of OpenWSN  
The IETF \"IPv6 over the TSCH mode of IEEE802.15.4e\" 6 TiSCH working group has standardized how to combine TSCH and IPv6 [28]. The 6 TiSCH protocol stack is rooted in IEEE802.15.4 at the PHY, and the TSCH mode of IEEE802.15.4e at the link layer. Multi-hop capability is supported at the routing layer via the IPv6 routing protocol for Low-Power and Lossy Networks (RPL). Furthermore, it uses 6 LoWPAN as an adaptation layer to interface between the routing layer and the specific operations of the MAC layer such as neighbor discovery, registration, ranking, and maintenance operations that impact how routes are calculated. The 6 TiSCH protocol stack has been ported to all main open-source IoT protocol stacks: OpenWSN, Contiki-NG, RIOT and TinyOS [16]. Since it is the reference implementation, and since it is ported to the OpenMote B, we use the OpenWSN implementation in this article. Prior to this work, OpenWSN only supported the IEEE802.15.4 O-QPSK 2.4 GHz PHY. Initial range measurements were conducted using the OpenMote's AT86 RF215 radio [1; 3], but the full 6 TiSCH stack had never been ported. We therefore extend OpenWSN to support the following PHYs--FSK 868 MHz, OFDM 868 MHz, and O-QPSK 2.4 GHz. This extension consists of three steps--writing the low-level drivers to configure the radio chips appropriately, tuning the durations within the timeslots to each PHY, and providing a clean software abstraction to allow the TSCH implementation to switch between them. Table 1 lists the main characteristics of the PHY layers tested; TX power and sensitivity number are taken for the chip used. We extend OpenWSN with a generic openradio interface. This interface driver implements the same set of functions called by the TSCH state machine, and maps them to that of the radio driver of the PHY being used. We further introduce a timeslot template for each PHY. The \"timeslot template\" consists of the appropriate timing of the sequence of phases within a timeslot, which we fine tuned using a logic analyzer. The duration of Serial Peripheral Interface (SPI) transactions, the datarate of the communication or the turn-around time of the radio all influence the timeslot template. Figure 1 illustrates the different timeslot templates when transmitting a 100 B data payload with acknowledgement. Red markers highlight the approximate time for SPI communications from the micro-controller to the AT86 rf215 radio (none for the CC2538 on-chip radio). A 40 ms slot template duration is used for options, allowing for fair comparison between all three PHYs. \begin{table}
\begin{tabular}{r r r r r r} \hline \hline  & **Radio Chip** & **Data Rate** & **TX Power** & **Sensitivity** & **Link Budget** \\ \hline FSK 868 MHz & AT86 RF215 & 50 kbps & +14.5 dBm & \(-\)114 dBm & 128.5 dB \\ OFDM 868 MHz & AT86 RF215 & 800 kbps & +10.0 dBm & \(-\)104 dBm & 114.0 dB \\ O-QPSK 2.4 GHz & CC2538 & 250 kbps & +07.0 dBm & \(-\)97 dBm & 104.0 dB \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The Physical Layer (PHY) layers tested. We use a slotframe length of 41 timeslots. Table 2 summarizes the parameters of the stack. Before this work, the memory footprint of the entire OpenWSN stack was 42 kB. This increases to 77 kB with the additions listed above, in particular with both the CC2538 and AT86 RF215 drivers. This is a very small footprint which comfortably fits in modern SoC which all have 512 kB of flash, or more. \begin{table}
\begin{tabular}{l r} \hline \hline
**Parameter** & **Value** \\ \hline Application traffic period & 60 s \\ RPL DIO period & 10 s \\ RPL DAO period & 60 s \\ neighbor table size & 45 \\ packet queue size & 15 \\ slotframe length & 41 \\ timeslot duration & 40 ms \\ EB probability & 10\% \\ Number of radio channels & 16 \\ New neighbor RSSI * threshold & \(-\)80 dBm \\ Max num. re-transmissions & 15 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of the OpenWSN protocol stack. Figure 1: Timeslot templates for the three PHYs. We use a 40 ms timeslot duration in all cases.