Lab 4 CRC, PDR vs. distance, preamble sampling Thomas Watteyne EE290Q – Spring 2010

Slides:



Advertisements
Similar presentations
Computer Interfacing and Protocols
Advertisements

Lecture 12 Layer 2 – Data Link Layer Protocols
1 Thomas EDERC Programming Tour.
LAB 6: Serial Communication
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao
EEC-484/584 Computer Networks Lecture 6 Wenbing Zhao
CSCI 4550/8556 Computer Networks Comer, Chapter 7: Packets, Frames, And Error Detection.
EEC-484/584 Computer Networks Lecture 8 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.
UNIT INSTRUMENT DEMONSTRATION OF CRC GENERATION Imran Shafique Ansari Saif Ahmad Ahmad Qutb Al-Deen
The OSI Reference Model
CS335 Networking & Network Administration Wednesday, April 7 PacketsPackets, Frames, and Error DetectionFramesError Detection.
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.
7/2/2015Errors1 Transmission errors are a way of life. In the digital world an error means that a bit value is flipped. An error can be isolated to a single.
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
Error Detection and Reliable Transmission EECS 122: Lecture 24 Department of Electrical Engineering and Computer Sciences University of California Berkeley.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao
Synchronous - Asynchronous Data Transmission. Asynchronous ► The sender and receiver are not Synchronised. ► The sender sends only one character at a.
Data Link Layer IS250 Spring 2010
NUS.SOC.CS2105 Ooi Wei Tsang Application Transport Network Link Physical you are here.
Lab 5 System Design Thomas Watteyne EE290Q – Spring 2010
Data Link Layer - 1 Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
LAB 8: Program Design Pattern and Software Architecture
Error Coding Transmission process may introduce errors into a message.  Single bit errors versus burst errors Detection:  Requires a convention that.
Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.
1 Part III Packet Transmission Chapter 7 Packets, Frames, and Error Detection.
Lecture 6: Framing and Error Detection-Data Link Layer Functions
COEN 180 Erasure Correcting, Error Detecting, and Error Correcting Codes.
Lab 2 energy consumption, wireless chat Thomas Watteyne EE290Q – Spring 2010
Data and Computer Communications by William Stallings Eighth Edition Digital Data Communications Techniques Digital Data Communications Techniques Click.
Practical Session 10 Error Detecting and Correcting Codes.
ECE453 – Introduction to Computer Networks Lecture 4 – Data Link Layer (I)
Computer Science Division
CSCI 465 D ata Communications and Networks Lecture 9 Martin van Bommel CSCI 465 Data Communications & Networks 1.
1 © Unitec New Zealand CRC calculation and Hammings code.
Error Detection.
Transmission Errors Error Detection and Correction.
Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
Practical Session 10 Computer Architecture and Assembly Language.
Dr. Clincy Professor of CS
Simple Parity Check The simplest form of error detection is the parity check used with ASCII codes, originally on asynchronous modem links Each 7 bit ASCII.
Modulo-2 Digital coding uses modulo-2 arithmetic where addition becomes the following operations: 0+0= =0 0+1= =1 It performs the.
The University of Adelaide, School of Computer Science
The Data Link Layer.
EMBEDDED SYSTEMS UNIT 4.
Computer Architecture and Assembly Language
Introduction to Information Technologies
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Data Link Layer.
Cyclic Redundancy Check (CRC)
Onward with Chat! Networking CS 3470, Section 1.
: An Introduction to Computer Networks
Dr. Clincy Professor of CS
4-Integrating Peripherals in Embedded Systems
Advanced Computer Networks
Chapter 7 Packets, Frames, and Error Detection
4-Integrating Peripherals in Embedded Systems
Part III Datalink Layer 10.
EEC-484/584 Computer Networks
Introduction to Information Technologies
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Transmission Errors Error Detection and Correction
Error Detection Neil Tang 9/26/2008
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Chapter 9 Error Detection and Correction
Computer Architecture and Assembly Language
Transmission Errors Error Detection and Correction
Data Link Layer. Position of the data-link layer.
Presentation transcript:

Lab 4 CRC, PDR vs. distance, preamble sampling Thomas Watteyne EE290Q – Spring

2 CRC: Cyclic Redundancy Check If PKTCTRL0.CRC_EN=1: – At Tx, data is hashed and result append to the packet as a 2-byte field – At Rx, data is hashed and result compared to CRC field, packet dropped if fails How CRC works – Calculate the remainder of a (binary) division – In CC2500, CRC-16-IBM (x 16 + x 15 + x 2 + 1) Single bit errors100% Double-bit errors100% Odd-Numbered errors100% Burst Errors Shorter than 16 bits100% Burst Errors of exactly 17 bits % All other burst errors %

3 CRC: Cyclic Redundancy Check Pick a CRC length – e.g. 3 bits Pick a polynom – e.g. x 4 +x+1 (1011) – (Always a leftmost 1!) While bits in data – Write under leftmost data bits – iif leftmost data bit is 1, XOR (leftmost bit always turns to 0) – Shift right one place Collect 3-bit CRC

4 The Importance of CRC [1/3] lab4_crc #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); } Enable UART reduce the Tx Power for more frequent errors disable CRC

5 The Importance of CRC [2/3] 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)); } when receiving a packet Copy RXFIFO to “packet” format string send string over serial lab4_crc

6 The Importance of CRC [3/3] #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; } when button is pressed comment out for continuous Tx Fill frame with ‘abcdef…’ Copy to TXFIFO and send lab4_crc

7 Channel Success Probability Receiver listens When button pressed sender sends a burst of packets – 100 packets with counter from 1 to 100 – 20 packets with counter to 101 When receiving a packet – If packet counter <101, increment a counter and store the RSSI – For the first packet with counter==101, display “average RSSI – channel success probability”

8 Channel Success Probability [1/4] #include "mrfi.h" uint8_t counter, num_received, bool_counting; int16_t cumulative_rssi; mrfiPacket_t packet; void print_probability(int16_t cumulative_rssi, uint8_t number) { char output[] = {" \n"}; if (cumulative_rssi<0) { output[0]='-'; cumulative_rssi=-cumulative_rssi; } output[1] = '0'+((cumulative_rssi/100)%10); output[2] = '0'+((cumulative_rssi/10)%10); output[3] = '0'+ (cumulative_rssi%10); output[5] = '0'+((number/100)%10); output[7] = '0'+((number/10)%10); output[8] = '0'+ (number%10); TXString(output, (sizeof output)-1); } e.g. “ ” Prepare string transmit string over serial lab4_pdr

9 Channel Success Probability [2/4] int main(void) { BSP_Init(); P1REN |= 0x04; P1IE |= 0x04; MRFI_Init(); mrfiSpiWriteReg(PATABLE,0x50); P3SEL |= 0x30; UCA0CTL1 = UCSSEL_2; UCA0BR0 = 0x41; UCA0BR1 = 0x3; UCA0MCTL = UCBRS_2; UCA0CTL1 &= ~UCSWRST; MRFI_WakeUp(); MRFI_RxOn(); __bis_SR_register(GIE+LPM4_bits); } when button is pressed enable serial communication Wait for interrupts in low power mode lab4_pdr

10 Channel Success Probability [3/4] void MRFI_RxCompleteISR() { P1OUT ^= 0x02; MRFI_Receive(&packet); counter = packet.frame[9]; if (counter==101) { if (bool_counting == 1) { print_probability(cumulative_rssi/num_received,num_received); } bool_counting=0; num_received=0; cumulative_rssi=0; } else { bool_counting=1; num_received++; cumulative_rssi+=(int8_t) packet.rxMetrics[0]; } When I receive a packet lab4_pdr

11 Channel Success Probability [4/4] #pragma vector=PORT1_VECTOR __interrupt void interrupt_button (void) { P1IFG &= ~0x04; P1OUT ^= 0x01; mrfiPacket_t packet; packet.frame[0]=8+3; for (counter=1;counter<101;counter++){ packet.frame[9]=counter; MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED); } for (counter=0;counter<20;counter++){ packet.frame[9]=101; MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED); } when button is pressed lab4_pdr