Fixing TinyOS rfxlink layer ACK handling
In my last post I wrote about a strange situation where packet with a length of 248 bytes was received by application layer.
Today I propose a possible fix or rather workaround to that situation.
Cause
This issue happens because error detection in rfxlink layers is not very effective. The problem I was experiencing was caused by incorrect ACK packet. Correct ACK packet must have following fields: fcf
and dsn
. First bit In fcf
field must be set and dsn
field must contain the same dsn
number that original packet had.
ACKs are handled in SoftwareAckLayerC.nc in the following way:
tasklet_async event message_t* SubReceive.receive(message_t* msg)
{
RADIO_ASSERT( state == STATE_ACK_WAIT || state == STATE_READY );
if( call Config.isAckPacket(msg) )
{
if( state == STATE_ACK_WAIT && call Config.verifyAckPacket(txMsg, msg) )
{
call RadioAlarm.cancel();
...