Lab measure on a coordinator and a sensor exchanging data in Non Beacon
Enable mode. Check the randomness of the access to the channel by varying
BE min . Evaluate the throughput by varying the payload of the packets
transmitted.
Wireless Sensor Networks: MAC protocol of a point-to-point NBE network
1. 05.12.12 Daniele Antonioli 606082 1
Wireless Sensor Networks
Lab Work #3
MAC Protocol
Point to point
Non Beacon Enable Network
2. 05.12.12 Daniele Antonioli 606082 2
Outline
● Check the randomness of the access to the
channel by varying BEmin
● Evaluate the throughput by varying the Payload
of the packets transmitted
7. 05.12.12 Daniele Antonioli 606082 7
How to transmit 50 consecutive
packets
case stateDataTx:
App_Tx();
if (count<50)
{count++;
gState = stateDataTx;
}
else
gState = stateListen;
// TS_SendEvent(gAppTaskID_c, gAppEvtDummyEvent_c);
break;
8. 05.12.12 Daniele Antonioli 606082 8
How to change the Payload
static void App_Tx(void)
{
if( (mcPendingPackets < mDefaultValueOfMaxPendingDataPackets_c) && (mpPacket == NULL) )
...................................................
mpPacket->msgData.dataReq.pMsdu = "oooo";
mpPacket->msgType = gMcpsDataReq_c;
/* Create the header using coordinator information gained during
the scan procedure. Also use the short address we were assigned
by the coordinator during association. */
FLib_MemCpy(mpPacket->msgData.dataReq.dstAddr, mCoordInfo.coordAddress, 8);
FLib_MemCpy(mpPacket->msgData.dataReq.srcAddr, maMyAddress, 8);
FLib_MemCpy(mpPacket->msgData.dataReq.dstPanId, mCoordInfo.coordPanId, 2);
FLib_MemCpy(mpPacket->msgData.dataReq.srcPanId, mCoordInfo.coordPanId, 2);
mpPacket->msgData.dataReq.dstAddrMode = mCoordInfo.coordAddrMode;
mpPacket->msgData.dataReq.srcAddrMode = mAddrMode;
mpPacket->msgData.dataReq.msduLength = 4;
......................
}
}
9. 05.12.12 Daniele Antonioli 606082 9
How to change MAC parameter
BEmin
case stateSetParam:
UartUtil_Print("Setto BEmin", gAllowToBlock_d);
uint8_t param1[1];
*param1=0;
App_SetMacPib_Example(gMPibMinBe_c,param1);
uint8_t param[1];
mlmeMessage_t mlmeGet;
mlmeGet.msgType=gMlmeGetReq_c;
mlmeGet.msgData.getReq.pibAttribute=gMPibMinBe_c;
mlmeGet.msgData.getReq.pibAttributeValue=param;
MSG_Send(NWK_MLME, &mlmeGet);
UartUtil_Print("Getto BEmin", gAllowToBlock_d);
UartUtil_PrintHex(param, 1, 0);
gState=stateDataTx;
TS_SendEvent(gAppTaskID_c,gAppEvtDummyEvent_c);
break;
10. 05.12.12 Daniele Antonioli 606082 10
How to change MAC parameter
BEmin
uint8_t App_SetMacPib_Example(uint8_t attribute, uint8_t
*pValue)
{
mlmeMessage_t mlmeSet;
/* Create and execute the Set request */
mlmeSet.msgType = gMlmeSetReq_c;
mlmeSet.msgData.setReq.pibAttribute = attribute;
mlmeSet.msgData.setReq.pibAttributeValue = pValue;
return MSG_Send(NWK_MLME, &mlmeSet);
}