RX/TX for 802.15.4 (not Zigbee)

Discussion in 'Embedded Systems and Microcontrollers' started by hazzman, Feb 10, 2008.

  1. hazzman

    Thread Starter Member

    Dec 17, 2007
    13
    0
    Hello people,

    i need to create a simple wireless protocol that just sends data, gets ACK, and receives data. Simple, rite? Anyway im using CC2430 which is 802.15.4 compliant and as far as i know i have a RF regisiter called RFD which writes to a 128 Byte TX or RX FIFO for transmission/receiving. I believe according to the specs i have to send the MPDU (MAC Protocol Data Unit) and its length into this FIFO which gets transmitted, the PHY uses CSMA/CA, and the 802.15.4 MAC layer frame looks like:

    MAC:
    Code ( (Unknown Language)):
    1.  
    2. Byte-    2              1         0-20            n            1
    3.        Frame_Cntrl_F   SeqNo   AddrInfo     FramePayload    FCS
    4.         | MAC Header                       | MAC Payload  | MAC Ftr|
    5.  
    6.  

    So i have a data struct like:
    Code ( (Unknown Language)):
    1.  
    2. typedef struct
    3. {
    4.   unsigned char flags;
    5.   unsigned char seqNo;
    6.   unsigned char destH;
    7.   unsigned char destL;
    8.   unsigned char *pDataBuffer;
    9.   unsigned char status;
    10. }SPP_TXPACKET;
    11.  
    As a struct lies in a contiguous space in MCU memory, am i rite as to just have a pointer to the beginnig of the struct like to '&flags' ? So then i would have a uint8 pointer that just traverses thru the MPDU with length of the MPDU ??
    So like to send it i would have:
    Code ( (Unknown Language)):
    1.  
    2. void writeTxFifo(uint8 *pData, uint8 len)
    3. {
    4.   if(len == 0); /* pointless to write zero bytes */
    5.     return;
    6.  
    7.   do
    8.   {
    9.     RFD = *pData;
    10.     pData++;
    11.     len--;
    12.   }
    13.   while (len);
    14.  
    15.  
    16.  
    17. in .c file:
    18. writeTxFifo(&(SPP_TXPACKET.flags), 7)     //this doesn't look rite, but you get the idea......
    19.  
    Is it this simple? With anyone with wireless programming experience please comment about the above?
     
Loading...