<< Chapter < Page Chapter >> Page >
Each packet is appended with a 16-bit Cyclic-Redundancy- Check ( CRC ) which is used to detect accidental alterations of data during transmission. CRC is computed over the data portion ofthe frame. Upon receiving a packet, the CC2500 recomputes a CRC over the received data and compares that values with the received CRC. Amismatch indicates a corrupted packet; by default, the CC2500 silently drops such a packet. You will disable CRC and see how often corrupted packets occur.

Running the code

  • Copy code presented below Alternatively, this code is available in the downloadable source code . Open source_code/iar_v4.11/lab_ezwsn.eww with IAR. The project corresponding to this section is called txrx_crc . .
  • Compile and download the code onto both boards (Ctrl+D) .
  • Connect one board to a computer using the USB programmer, and read its output using PuTTY.
  • Power the other with the battery packet and press the button. You should read 'abcdefghijklmnopqrstu' on PuTTY.
  • Repeat his multiple times by moving away the sending node; you should see some alterations to the output text. If CRC was enabled, these packet would havebeen dropped by the CC2500 and you wouldn't see them on the screen.
  • You may wish to speed things up by changing P1IFG&= ~0x04; to P1IFG |= 0x04; on the sender's side so one press of the button generates an infinite stream of packets. Similarly, youmay wish to reduce its transmission power as explained in 4.3. Continuous Tx/Rx .
#include "radios/family1/mrfi_spi.h" #include "mrfi.h"mrfiPacket_t packetToSend; int main(void){ BSP_Init();P1REN |= 0x04; P1IE |= 0x04;MRFI_Init(); mrfiSpiWriteReg(PATABLE,0xBB);mrfiSpiWriteReg(PKTCTRL0,0x41); P3SEL |= 0x30;UCA0CTL1 = UCSSEL_2; UCA0BR0 = 0x41;UCA0BR1 = 0x3; UCA0MCTL = UCBRS_2;UCA0CTL1&= ~UCSWRST; MRFI_WakeUp();MRFI_RxOn(); __bis_SR_register(GIE+LPM4_bits);} void MRFI_RxCompleteISR(){ uint8_t i;P1OUT ^= 0x02; mrfiPacket_t packet;MRFI_Receive(&packet); char output[]= {" \r\n"}; for (i=9;i<packet.frame[0];i++) {output[i-9]=packet.frame[i]; }TXString(output, (sizeof output)); }#pragma vector=PORT1_VECTOR __interrupt void Port_1 (void){ P1IFG&= ~0x04; char character = 'a';uint8_t index; mrfiPacket_t packet;for (index=9;index<30;index++) { packet.frame[index]=character++; }packet.frame[0]=++index;MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED); P1OUT ^= 0x01;}

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500. OpenStax CNX. Apr 26, 2009 Download for free at http://cnx.org/content/col10684/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500' conversation and receive update notifications?

Ask