PacketLink

From TinyOS Wiki
Jump to: navigation, search

PacketLink is a layer added to the CC2420 radio stack to help unicast packets get delivered successfully. In previous version of TinyOS radio stacks, it was left up to the application layer to retry a message transmission if the application determined the message was not properly received. The PacketLink layer helps to remove the reliable delivery responsibility and functional baggage from application layers.

Compiling in the PacketLink Layer

Because the PacketLink layer uses up extra memory footprint, it is not compiled in by default. Developers can simply define the preprocessor variable PACKET_LINK to compile the functionality of the PacketLink layer in with the CC2420 stack.

Implementation and Usage

To send a message using PacketLink, the PacketLink interface must be called ahead of time to specify two fields in the outbound message's metadata:

 command void setRetries(message_t *msg, uint16_t maxRetries);
 command void setRetryDelay(message_t *msg, uint16_t retryDelay);

The first command, setRetries(..), will specify the maximum number of times the message should be sent before the radio stack stops transmission. The second command, setRetryDelay(..), specifies the amount of delay in milliseconds between each retry. The combination of these two commands can set a packet to retry as many times as needed for as long as necessary.

Because PacketLink relies on acknowledgements, false acknowledgements from the receiver will cause PacketLink to fail. If using software acknowledgements, false acknowledgements can still occur as a result of the limited DSN space, other 802.15.4 radios in the area with the same destination address, etc.


See Also

Next