FAQ

From TinyWiki

Jump to: navigation, search

Contents

Messaging

When I call Send.send(...) or SendMsg.send(...) twice in the same function, why doesn't the second call do anything?

Send.send(...) is a "non-blocking" call. The purpose of the call is to enqueue a message to be sent. If the queue is full, then the call will return FAIL instead of waiting for the queue to become empty. The reason why the second call to Send.send(...) fails is this: the queue provided by GenericComm holds only one message.

Lesson: Always check the result of your call to Send.send(...).

If it fails, here are some things to try:

  • Start a periodic Timer, and try sending the message each time you receive the Timer.fired() event. If the send fails, then wait until the next time the timer fires. This may be acceptable if your timer fires often enough. If it fires once every five minutes, you may want to take sterner measures.
  • Store the message you were going to send. When you receive the Send.sendDone(...) event, post a task, and in that task, try sending the message again. If it fails, leave it in storage for the next Send.sendDone(...) event.
  • Give up. What's one message among friends? Your messages are also likely to be lost due to radio traffic. Losing a message to radio traffic or losing a message to a busy radio are pretty similar, when it comes down to it. If you're writing a reliable protocol, it should handle both kinds of failure.

I want to create a multi-hop network in a small area. How can I lower the radio range?

CC2420 Platforms (Telos A, Telos B)

Wire to CC2420RadioC.CC2420Control.

Call CC2420Control.SetRFPower( power value).

Valid power values are:

Power Value Output Power [dBm] Current Consumption [mA]
31 0 17.4
27 -1 16.5
23 -3 15.2
19 -5 13.9
15 -7 12.5
11 -10 11.2
7 -15 9.9
3 -25 8.5

Be aware that radio performance degrades at low power levels. In addition to lowering the range, you'll be raising the chance that a packet gets corrupted in transit.

Which Java classes send bytes to the serial port, and which Java classes send packets?

net.tinyos.packet.SerialByteSource sends bytes to the serial port.

net.tinyos.packet.Packetizer sends whole packets to the serial port, and encapsulates them in the TinyOS framing protocol.

Personal tools