2. Goal:
Radio Communication
Familiarity with TINYOS interfaces and
components
Learn How to
- message buffer : message_t for tinyOS 2.x
- Send a message buffer to the radio
- Receive a message buffer from the radio
Ankit Singh
Mote Mote Radio Communication
3. Introduction
* All interfaces and components use a common
message buffer abstraction, called
message_t implemented in nesC struct.
* message_t replaces tinyOS 1.x TOS_Msg
abstraction
Mote Mote Radio Communication
Ankit Singh
4. Basic Communication Interfaces
Packet - Basic Accessor for Message_t abstract type
In detail:
Clear out the packet:
command void clear(message_t* msg);
Return the length of the payload:
command uint8_t payloadLength(message_t* msg);
Set the length field of the packet:
command void setPayloadLength(message_t* msg, uint8_t len);
Return the maximum payload length:
command uint8_t maxPayloadLength();
Return a pointer to a protocol's payload region in a packet:
command void* getPayload(message_t* msg, uint8_t len);
Mote Mote Radio Communication
Ankit Singh
5. Basic Communication Interfaces
Send - Send a packet with a data payload of len.
- provides commands for sending and canceling a pending message send.
In Detail:
Send packet return SUCCESS, the component will signal sendDone event
in the future else will not signal sendDone.
command error_t send(message_t* msg, uint8_t len);
Cancel a requested transmission
command error_t cancel(message_t* msg);
Signaled in response to an accepted send request.
event void sendDone(message_t* msg, error_t error);
Return the maximum payload length that this communication layer can provide.
command uint8_t maxPayloadLength();
Mote Mote Radio Communication
Ankit Singh
6. Basic Communication Interfaces
Receiver- Receive a packet buffer, returning a buffer for the signaling
component to use for the next reception.
Misuse: Most common bugs in TinyOS code. (will show in implementation)
The problem: The new message is not being sent out.
event message_t* receive(message_t* msg, void* payload, uint8_t len);
PacketAcknowledgements - Provides a mechanism for requesting
acknowledgements on a per-packet basis.
RadioTimeStamping - Provides time stamping information for radio
transmission and reception. Provides the time at which start of frame
delimiter has been transmitted: units are in terms of a 32kHz clock.
Mote Mote Radio Communication
Ankit Singh
7. Basic Communication Interfaces
Receiver- Receive a packet buffer, returning a buffer for the signaling
component to use for the next reception.
Misuse: Most common bugs in TinyOS code. (will show in implementation)
The problem: The new message is not being sent out.
event message_t* receive(message_t* msg, void* payload, uint8_t len);
PacketAcknowledgements - Provides a mechanism for requesting
acknowledgements on a per-packet basis.
RadioTimeStamping - Provides time stamping information for radio
transmission and reception. Provides the time at which start of frame
delimiter has been transmitted: units are in terms of a 32kHz clock.
Mote Mote Radio Communication
Ankit Singh
8. Basic Communication Interfaces
Active Message Interfaces:
AMPacket - Similar to Packet, provides the basic AM accessors for the
message_t abstract data type. This interface provides commands for getting
a node's AM address, an AM packet's destination, and an AM packet's type.
Commands are also provides for setting an AM packet's destination and
type, and checking whether the destination is the local node.
AMSend - Similar to Send, provides the basic Active Message sending
interface. The key difference between AMSend and Send is that AMSend
takes a destination AM address in its send command.
Mote Mote Radio Communication
Ankit Singh
9. DEMO: BlinkToRadio Application
Objective:
i) Incrementing a counter
ii) Displaying the three lowest bits of the counter on the
LED's
iii) Transmitting the node's id and counter value over the radio
Now, let's move to the console and run the
Demo!!!
Mote Mote Radio Communication
Ankit Singh
10. DEMO: BlinkToRadio Application
Objective:
i) Incrementing a counter
ii) Displaying the three lowest bits of the counter on the
LED's
iii) Transmitting the node's id and counter value over the radio
Now, let's move to the console and run the
Demo!!!
Mote Mote Radio Communication
Ankit Singh