30
CSE 145 Underwater Modem Project Networking Library Robert Chen

Underwater Modem Project Networking Library Robert Chen

Embed Size (px)

Citation preview

PowerPoint Presentation

CSE 145Underwater Modem ProjectNetworking Library

Robert ChenPurposeGoal: 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 platformsMicrocontrollers, Computers, Cell Phones, etc.Easy to use, well documented

FPGA/DSPModem ComponentsTransducer/AmplifierPSKFSKDSSSASKDatalink/NetworkPhysical LayerPacket/HostLayerTransportHARDWARE ZONESOFTWARE ZONESOFTWARE ZONEHARDWARE ZONESimple Model1010001010011111010001010010.

1010001010011111010001010010.stringstring4Type = 8 bitsFrame FormatTotal: 72 bits / 9 bytesToFromCRCData BytesCounterSimple Example Frame0x010x020x00HI!/00xE90x25sendString(0x02, HI!);

Structure Representation

Example ProgramsProgram 1 (0x21): sendString(0x31, HELLO WORLD!!!);

Program 2 (0x31):recvString(0x21, %s, buffer);Program 1: String to FramesString is broken upPut into frames that hold 4 bytes each0x010x000x00HELL0x000x000x010x000x00O WO0x000x000x010x000x00RLD!0x000x000x010x000x00!!/0/00x000x00Program 1: AddressingFill in To / From address fields0x010x310x00HELL0x000x210x010x310x00O WO0x000x210x010x310x00RLD!0x000x210x010x310x00!!/0/00x000x21Program 1: TX QueueFrames are then added to transmit queue in string order

What happens now?

Blocking ImplementationProcess queue immediately

Non-Blocking ImplementationManual function call to process queue when convenient, i.e. by interruptProgram 1: Process TX Queue For all frames on TX Queue:POP and add to a window of size XWindow = fixed length set of frames, 5 in this ex.

0x010x310x00HELL0x000x210x010x310x00O WO0x000x210x010x310x00RLD!0x000x210x010x310x00!!/0/00x000x210x010x310x00/0/0/0/00x000x21Program 1: Numbering and CRCNumber off FramesCalculate CRC Cyclic Redundancy Check0x010x310x00HELL0xB70x210x010x310x01O WO0x9F0x210x010x310x02RLD!0x030x210x010x310x03!!/0/00x250x210x010x310x04/0/0/0/00xC00x21Program 1: Send WindowFor all frames in window, send byte by byte as a stream of bytes

Waits for ACK responsesSTOP HERESTART HEREProgram 2: Receive WindowReceive stream of bytesKnown: WINDOW SIZE X FRAME LENGTH5 X 9 bytes = 45 bytes

#1#2#3#4#5Program 2: Reconstitute FramesPerform CRC check on each received frame

0x010x310x00HELL0xB70x210x010x310x01O XL0x9F0x210x010x310x02RLD!0x030x210x010x310x03!!/0/00x000x210x010x310x04/0/0/0/00xC00x21OK!BAD!OK!BAD!OK!Program 2: ACK ResponseFor all OK frames

Respond: I got frame #X

For all BAD frames, do nothingSender will send the missing frame again if it doesnt get a valid response before timeout0x010x310x00HELL0xB70x210x060x210x000x000x000x000x000x7F0x31Program 2: Re-build Window0x010x310x00HELL0xB70x010x010x310x01O WO0x9F0x010x010x310x02RLD!0x030x010x010x310x03!!/0/00x250x010x010x310x04/0/0/0/00xC00x01Program 2: Reform StringHELLO WORLD!!!000000Assume 0 = /0

HELLO WORLD!!!/0/0/0/0/0/0Example ProgramProgram 1 (0x21): sendString(0x31, HELLO WORLD!!!);

Program 2 (0x31):recvString(0x21, %s, buffer);SimulationApplication #1Library COM 4||COM 5LibraryApplication #2

Design ConstraintsUse 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 timeThe 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

Key FeaturesKISS PrincipleUsability- Printf style statementsWorks with many data typesEasy to Debug and TroubleshootFlexible, rapid development

TradeoffLess efficient, sends more dataMay be slightly disadvantageous in a low power setting

Possible ApplicationsUnderwater 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);Possible Applications (contd)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 Digsbroadcast(BUOY 3 IS GRID 7B );rbroadcast(%s, broadcastbuffer);

Room for ImprovementInterface and test with actual hardware

Experiment withDifferent Environments Dynamically adjust according to error rateDifferent windows sizes and frame data field lengths

Challenges & ProblemsLate project start

Matlab + Serial =

ResultsLibrary is highly functional and usable

Major objectives achieved, project is a success

AcknowledgementsThanks!

Prof. Ryan KastnerDiba MirzaJennifer TrezzoNancy WuQuestions?