1 / 15

Wireless Networks Lab – Wireless

Wireless Networks Lab – Wireless. 2007/10/31 Chia-Hung Tsai. Lab5. FontalBSP LED UART Stack Wireless Application Queue API Hardware interrupt Mcps interrupt. PIB. PIB P AN I nformation B ase Consist of a number of parameters used by MAC and Physical layers Access

hazel
Télécharger la présentation

Wireless Networks Lab – Wireless

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wireless Networks Lab – Wireless 2007/10/31 Chia-Hung Tsai

  2. Lab5 • FontalBSP • LED • UART • Stack • Wireless • Application Queue API • Hardware interrupt • Mcps interrupt

  3. PIB • PIB • PAN Information Base • Consist of a number of parameters used by MAC and Physical layers • Access • The mechanism that a network layer can used is reading (GET) and writing (Set)

  4. MAC layer PIB access • Get a handle to the PIB

  5. MAC layer PIB access • Some attributes needs to be done using auxiliary functions

  6. Transmit a Packet for MAC PIB • Set a PAN ID • Set the short address

  7. Physical layer PIB access • PHY PIB parameter values • can be returned to the network layer using the eAppApiPlmeGet routine • can be changed by the network layer using the PLME-Set request primitive • eAppApiPlmeSet routine

  8. Physical layer PIB access example • eAppApiPlmeGet • eAppApiPlmeSet

  9. Transmit a Packet for PHY PIB • Set the transmitting channel

  10. macRxOnWhenIdle • macRxOnWhenIdle • Indication of whether the MAC sublayer is to enable its receiver during idle periods • BeaconOlder default is set to 15 • If BO is equal to 15, the value of macRxOnWhenIdle shall be considered relevant at all times • MAC_vPibSetRxOnWhenIdle(s_pvMac, TRUE, FALSE);

  11. Lab5 sample • tx.c • A blink application • When it toggle its LED0, it will send a packet to rx node • rx.c • When it receive a packet from tx node, it will toggle its LED0 also • So, rx.c is still a blink application

  12. Lab sample PUBLIC void AppColdStart(void) { InitSystem(); while (TRUE) { vAHI_CpuDoze(); } }

  13. Lab5 sample PRIVATE void InitSystem(void) { u32AHI_Init(); u32AppQApiInit(NULL, ReceiveISR, NULL); s_pvMac = pvAppApiGetMacHandle(); s_psMacPib = MAC_psPibGetHandle(s_pvMac); MAC_vPibSetPanId(s_pvMac, PAN_ID); MAC_vPibSetShortAddr(s_pvMac, RX); eAppApiPlmeSet(PHY_PIB_ATTR_CURRENT_CHANNEL, CHANNEL); MAC_vPibSetRxOnWhenIdle(s_pvMac, TRUE, FALSE); led_init(); led_on(LED0); led_on(LED1); }

  14. Send packet PRIVATE void sendPacket(void) { MAC_McpsSyncCfm_s sMcpsSyncCfm; MAC_McpsReqRsp_s sMcpsReqRsp; sMcpsReqRsp.u8Type = MAC_MCPS_REQ_DATA; sMcpsReqRsp.u8ParamLength = sizeof(MAC_McpsReqData_s); sMcpsReqRsp.uParam.sReqData.u8Handle=0; sMcpsReqRsp.uParam.sReqData.sFrame.sSrcAddr.u8AddrMode=2; sMcpsReqRsp.uParam.sReqData.sFrame.sSrcAddr.u16PanId=PAN_ID; sMcpsReqRsp.uParam.sReqData.sFrame.sSrcAddr.uAddr.u16Short =TX; sMcpsReqRsp.uParam.sReqData.sFrame.sDstAddr.u8AddrMode=2; sMcpsReqRsp.uParam.sReqData.sFrame.sDstAddr.u16PanId=PAN_ID; sMcpsReqRsp.uParam.sReqData.sFrame.sDstAddr.uAddr.u16Short = RX; sMcpsReqRsp.uParam.sReqData.sFrame.u8TxOptions = 1; sMcpsReqRsp.uParam.sReqData.sFrame.u8SduLength = 0; sMcpsReqRsp.uParam.sReqData.sFrame.au8Sdu[0] = '\0'; vAppApiMcpsRequest(&sMcpsReqRsp, &sMcpsSyncCfm); }

  15. Lab5 • Implement a small game that is similar with the bonus part in Lab4 • Using wireless to replace the UART • Requirement • Tx node will be setting a number by hyper terminal through UART • Rx node will guess a number through UART and send this number to Tx node • If Rx is guessed a smaller number, Tx will relay “the answer is bigger” • Else , if Rx is guessed a bigger number, Tx will reply “the answer is smaller” • Else, reply “you are right”

More Related