An example Program for the SimpleSerialProtocol Library, This program will receive a packet, then echo it back to the client

Dependencies:   mbed SimpleSerialProtocol MODSERIAL

A simple example program that receives a packet over serial and echos it back.

I include this java program to show an example client application, all this program does is send packets as fast as it can without filling up its output buffer, the mbed will echo these packets back.

This is a good benchmark of the serial connection, and should show about 11KB/s at 115200baud

/media/uploads/p3p/serialecho.zip

example command: java -jar SerialEcho.jar com3 115200

Committer:
p3p
Date:
Mon Jan 16 22:46:45 2012 +0000
Revision:
2:8799090c0fe4
Parent:
0:109a0b974600
Child:
10:f6862abba2d5
Modified to reflect changes in the SimpleSerialProtocol Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
p3p 2:8799090c0fe4 1 #include "mbed.h"
p3p 2:8799090c0fe4 2 #include "Protocol.h"
p3p 2:8799090c0fe4 3 #include "TestProtocol.h"
p3p 2:8799090c0fe4 4
p3p 2:8799090c0fe4 5 //valid test packet bytes
p3p 2:8799090c0fe4 6 //
p3p 2:8799090c0fe4 7 // 255 127 // packet start 2 bytes
p3p 2:8799090c0fe4 8 // 12 // payload size 1 byte
p3p 2:8799090c0fe4 9 // 0 0 0 0 0 0 0 0 0 0 0 0 // payload data
p3p 2:8799090c0fe4 10 // 16 // checksum 1 byte
p3p 2:8799090c0fe4 11
p3p 2:8799090c0fe4 12 //checksum calculation
p3p 2:8799090c0fe4 13 //
p3p 2:8799090c0fe4 14 // uint8_t tmp_checksum = 16;
p3p 2:8799090c0fe4 15 // for (int i = 0; i < packet_size; i++) {
p3p 2:8799090c0fe4 16 // tmp_checksum ^= packet[i];
p3p 2:8799090c0fe4 17 // }
p3p 2:8799090c0fe4 18 // return tmp_checksum;
p3p 2:8799090c0fe4 19
p3p 2:8799090c0fe4 20 TestProtocol testProtocol;
p3p 2:8799090c0fe4 21
p3p 2:8799090c0fe4 22 //the main loop
p3p 2:8799090c0fe4 23 int main() {
p3p 2:8799090c0fe4 24 testProtocol.initialise();
p3p 2:8799090c0fe4 25 while (1) {
p3p 2:8799090c0fe4 26 testProtocol.update();
p3p 2:8799090c0fe4 27 }
p3p 2:8799090c0fe4 28 }