10.09.2016 Views

Hacking_and_Penetration_Testing_with_Low_Power_Devices

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Saving power<br />

185<br />

on the modem. The PL parameter can be set between 0 <strong>and</strong> 4, <strong>with</strong> 4 (the default)<br />

being the highest transmit power possible.<br />

Modems may be put into one of the available sleep modes. When powered down,<br />

XBee modems consume less than 50 mA at 3.3 V. Recall that traffic for Series 2<br />

modems will be stored by the parent coordinator or router until an end device comes<br />

back online. Packets destined for sleeping Series 1 modems will be lost unless resent<br />

by the other party.<br />

There are four sleep modes, not counting the default of not permitting sleep. Half<br />

of these are pin sleep modes <strong>and</strong> the other half are cyclic sleep modes. Sleep modes<br />

are selected by setting the SM (sleep mode) parameter on a modem to a value<br />

between 0 <strong>and</strong> 5. The default value of 0 disables sleeping.<br />

Sleep mode 1, pin hibernate, is the most efficient sleep mode. In this mode, applying<br />

3.3 V to the sleep pin (pin 9) will cause the modem to sleep after finishing any<br />

current receive, transmit, or association operations. Dropping the pin to ground will<br />

cause the modem to wake up in about 10 milliseconds. Modems sleeping in this mode<br />

consume less than 10 mA.<br />

Sleep mode 2, pin doze, is similar to pin hibernate but <strong>with</strong> faster wake-up times.<br />

Typical wake-up time for modems operated in this mode is 2.6 ms. The price for this<br />

faster wake-up time is a higher sleeping current. According to Digi, modems sleeping<br />

in this mode consume less than 50 mA. Considering that a BeagleBone Black has an<br />

average current draw that is more than 4000 times this amount, there is no practical<br />

difference between this mode <strong>and</strong> pin hibernate mode for our purposes. The cyclic<br />

sleep modes also use less than 50 mA.<br />

In order to use pin sleep modes, the sleep pin jumper must be installed on the<br />

XBee cape or mini-cape described in the previous chapter. Recall that the sleep<br />

pin is gpio69. The modem can be put to sleep using echo 1 >/sys/class/gpio/<br />

gpio69/value. Echoing the value 0 (low) to the same pseudo file <strong>with</strong> the comm<strong>and</strong><br />

echo 0 >/sys/class/gpio/gpio69/value reawakens the modem.<br />

Sleep mode 4 (there is no sleep mode 3), cyclic sleep remote, puts a modem to<br />

sleep. The modem will wake up once every sleep cycle <strong>and</strong> poll its coordinator for<br />

any stored data. The sleep cycle period is determined by the value of the SP (cyclic<br />

sleep period) variable. If there are any queued data to be exchanged, the modem will<br />

remain awake after the transfer is complete until the SP (time before sleep) timer<br />

expires. The ST parameter sets the awake time before the modem returns to sleep.<br />

If there are no queued data, the modem immediately sleeps for another sleep<br />

cycle period.<br />

Sleep mode 5, cyclic sleep remote <strong>with</strong> pin wake-up, is similar to sleep mode<br />

4. The only difference is that in addition to the periodic waking, the modem may<br />

also be awakened via the sleep pin. Unlike the pin sleep modes, a falling edge<br />

transition (high to low) <strong>and</strong> not the voltage level will awaken the modem. In other<br />

words, the sleep pin is edge-triggered, not level-triggered as in the pin sleep<br />

modes. The advantage of this mode over mode 4 is that the modem is more easily<br />

awakened prematurely to send urgent data before the next scheduled wakeup<br />

time.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!