1 / 30

CSE 145

CSE 145. Underwater Modem Project Networking Library Robert Chen. Purpose. Goal: To develop an API that will enable programmable devices and appliances to easily interface with the underwater acoustic modem Deliverable: C API and programming library Requirements:

umika
Download Presentation

CSE 145

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. CSE 145 Underwater Modem Project Networking Library Robert Chen

  2. Purpose • Goal: To develop an API that will enable programmable devices and appliances to easily interface with the underwater acoustic modem • Deliverable: C API and programming library • Requirements: • Portable on different platforms • Microcontrollers, Computers, Cell Phones, etc. • Easy to use, well documented

  3. Modem Components Packet/Host Layer Transport Datalink/Network FPGA/DSP Physical Layer PSK FSK DSSS ASK Transducer/Amplifier

  4. Simple Model SOFTWARE ZONE “string” 1010001010011111010001010010…. HARDWARE ZONE HARDWARE ZONE 1010001010011111010001010010…. SOFTWARE ZONE “string”

  5. Frame Format = 8 bits Total: 72 bits / 9 bytes • Data Bytes • Type • CRC • Counter • To • From

  6. Simple Example Frame sendString(0x02, “HI!”); 0x01 0x02 0x25 0x00 ‘H’ ‘I’ ‘!’ ‘/0’ 0xE9

  7. Structure Representation

  8. Example Programs • Program 1 (0x21): • sendString(0x31, “HELLO WORLD!!!”); • Program 2 (0x31): • recvString(0x21, “%s”, buffer);

  9. Program 1: String to Frames 0x01 0x00 0x00 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0x00 0x01 0x00 0x00 0x00 ‘O’ ‘ ’ ‘W’ ‘O’ 0x00 0x01 0x00 0x00 0x00 ‘R’ ‘L’ ‘D’ ‘!’ 0x00 0x01 0x00 0x00 0x00 ‘!’ ‘!’ ‘/0’ ‘/0’ 0x00 • String is broken up • Put into frames that hold 4 bytes each

  10. Program 1: Addressing 0x01 0x31 0x21 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0x00 0x01 0x31 0x21 0x00 ‘O’ ‘ ’ ‘W’ ‘O’ 0x00 0x01 0x31 0x21 0x00 ‘R’ ‘L’ ‘D’ ‘!’ 0x00 0x01 0x31 0x21 0x00 ‘!’ ‘!’ ‘/0’ ‘/0’ 0x00 Fill in To / From address fields

  11. Program 1: TX Queue • Frames are then added to transmit queue in string order • What happens now? • Blocking Implementation • Process queue immediately • Non-Blocking Implementation • Manual function call to process queue when convenient, i.e. by interrupt

  12. Program 1: Process TX Queue 0x01 0x31 0x21 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0x00 0x01 0x31 0x21 0x00 ‘O’ ‘ ’ ‘W’ ‘O’ 0x00 0x01 0x31 0x21 0x00 ‘R’ ‘L’ ‘D’ ‘!’ 0x00 0x01 0x31 0x21 0x00 ‘!’ ‘!’ ‘/0’ ‘/0’ 0x00 0x01 0x31 0x21 0x00 ‘/0’ ‘/0’ ‘/0’ ‘/0’ 0x00 • For all frames on TX Queue: • POP and add to a window of size X • Window = fixed length set of frames, 5 in this ex.

  13. Program 1: Numbering and CRC 0x01 0x31 0x21 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0xB7 0x01 0x31 0x21 0x01 ‘O’ ‘ ’ ‘W’ ‘O’ 0x9F 0x01 0x31 0x21 0x02 ‘R’ ‘L’ ‘D’ ‘!’ 0x03 0x01 0x31 0x21 0x03 ‘!’ ‘!’ ‘/0’ ‘/0’ 0x25 0x01 0x31 0x21 0x04 ‘/0’ ‘/0’ ‘/0’ ‘/0’ 0xC0 Number off Frames Calculate CRC – Cyclic Redundancy Check

  14. Program 1: Send Window START HERE STOP HERE For all frames in window, send byte by byte as a stream of bytes Waits for ACK responses

  15. Program 2: Receive Window #1 #2 #3 #4 #5 • Receive stream of bytes • Known:WINDOW SIZE XFRAME LENGTH • 5 X 9 bytes = 45 bytes

  16. Program 2: Reconstitute Frames OK! 0x01 0x31 0x21 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0xB7 BAD! 0x01 0x31 0x21 0x01 ‘O’ ‘ ’ ‘X’ ‘L’ 0x9F OK! 0x01 0x31 0x21 0x02 ‘R’ ‘L’ ‘D’ ‘!’ 0x03 BAD! 0x01 0x31 0x21 0x03 ‘!’ ‘!’ ‘/0’ ‘/0’ 0x00 OK! 0x01 0x31 0x21 0x04 ‘/0’ ‘/0’ ‘/0’ ‘/0’ 0xC0 Perform CRC check on each received frame

  17. Program 2: ACK Response 0x01 0x31 0x21 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0xB7 0x06 0x21 0x31 0x00 0x00 0x00 0x00 0x00 0x7F • For all OK frames • Respond: “I got frame #X” • For all BAD frames, do nothing • Sender will send the missing frame again if it doesn’t get a valid response before timeout

  18. Program 2: Re-build Window 0x01 0x31 0x01 0x00 ‘H’ ‘E’ ‘L’ ‘L’ 0xB7 0x01 0x31 0x01 0x01 ‘O’ ‘ ’ ‘W’ ‘O’ 0x9F 0x01 0x31 0x01 0x02 ‘R’ ‘L’ ‘D’ ‘!’ 0x03 0x01 0x31 0x01 0x03 ‘!’ ‘!’ ‘/0’ ‘/0’ 0x25 0x01 0x31 0x01 0x04 ‘/0’ ‘/0’ ‘/0’ ‘/0’ 0xC0

  19. Program 2: Reform String ‘H’ ‘E’ ‘L’ ‘L’ ‘O’ ‘ ’ ‘W’ ‘O’ ‘R’ ‘L’ ‘D’ ‘!’ ‘!’ ‘!’ ‘/0’ ‘/0’ ‘/0’ ‘/0’ ‘/0’ ‘/0’ • “HELLO WORLD!!!000000” • Assume 0 = ‘/0’

  20. Example Program • Program 1 (0x21): • sendString(0x31, “HELLO WORLD!!!”); • Program 2 (0x31): • recvString(0x21, “%s”, buffer);

  21. Simulation Application #1 Library COM 4 | | COM 5 Library Application #2

  22. Design Constraints • Use of a constant time, fixed sized queue which does not use the heap • No use of heap: • Flaky memory management support on some embedded platforms. • The runtime memory space of the library is known by compile time • “The lowest average instruction path length required to allocate a single memory slot was 52 (as measured with an instruction level profiler on a variety of software)” • Small CRC algorithm, 8 bit output • Plain standard C, no special libraries

  23. Key Features • KISS Principle • Usability- Printf style statements • Works with many data types • Easy to Debug and Troubleshoot • Flexible, rapid development • Tradeoff • Less efficient, sends more data • May be slightly disadvantageous in a low power setting

  24. Possible Applications • Underwater UAV • sendString(0xF3, “x: %d y: %d z: %d”, my_x, my_y, my_z); • recvString(0xF3, “x: %d y: %d z: %d”, &uav_x, &uav_y, &uav_z); • Underwater Sensor Platform • sendString(0xF2, “temperature: %2.f, oxygen: %d”, temp, oxy); • recvString(0xF2, “temperature: %2.f, oxygen: %d”, &temp, &oxy);

  25. Possible Applications (cont’d) • Communications Device for Divers • sbroadcast(“%s: %s”, username, message); • rbroadcast(“%s: %s”, buddy, his_message); • Message Beacon on a Buoy floating above an Underwater Archaeological Dig • sbroadcast(“BUOY 3 IS GRID 7B ”); • rbroadcast(“%s”, broadcastbuffer);

  26. Room for Improvement • Interface and test with actual hardware • Experiment with… • Different Environments • Dynamically adjust according to error rate • Different windows sizes and frame data field lengths

  27. Challenges & Problems Late project start Matlab+ Serial = 

  28. Results Library is highly functional and usable Major objectives achieved, project is a success

  29. Acknowledgements • Thanks! • Prof. Ryan Kastner • DibaMirza • Jennifer Trezzo • Nancy Wu

  30. Questions?

More Related