aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2013-02-27 15:54:06 +0100
committerJakob Odersky <jodersky@gmail.com>2013-02-27 15:54:15 +0100
commitf56af0f9e5e0665bb3f582f01f0ac18ce88ee4bb (patch)
tree606ebb87c7bc8820e407c0fde96d77d1dcebf24b
parent793983ca31eb05fce655ed5877b6f3faa4577acd (diff)
downloadace-f56af0f9e5e0665bb3f582f01f0ac18ce88ee4bb.tar.gz
ace-f56af0f9e5e0665bb3f582f01f0ac18ce88ee4bb.tar.bz2
ace-f56af0f9e5e0665bb3f582f01f0ac18ce88ee4bb.zip
fix error of byte values in specification
-rw-r--r--c/arduino/framing.h6
-rw-r--r--c/arduino/test.ino12
-rw-r--r--specification/specification.pdfbin156101 -> 156052 bytes
-rw-r--r--specification/specification.tex12
4 files changed, 13 insertions, 17 deletions
diff --git a/c/arduino/framing.h b/c/arduino/framing.h
index daacba7..fc2cd12 100644
--- a/c/arduino/framing.h
+++ b/c/arduino/framing.h
@@ -9,9 +9,9 @@ extern "C" {
#include <inttypes.h>
#define MAX_FRAME_SIZE 128
-#define FRAME_ESCAPE 0x02
-#define FRAME_START 0x03
-#define FRAME_STOP 0x10
+#define FRAME_ESCAPE 0x10
+#define FRAME_START 0x02
+#define FRAME_STOP 0x03
typedef enum {
WAITING,
diff --git a/c/arduino/test.ino b/c/arduino/test.ino
index e9df65f..ce48712 100644
--- a/c/arduino/test.ino
+++ b/c/arduino/test.ino
@@ -13,18 +13,19 @@ void ace_event(message_event e, int16_t size, const uint8_t* const message) {
digitalWrite(ERR_PIN, LOW);
lcd.clear();
for(int i = 0; i < size; ++i) {
- lcd.write(message[i]);
+ lcd.print(message[i]);
}
}
else {
digitalWrite(ERR_PIN, HIGH);
lcd.clear();
+ lcd.print("txerr: ");
lcd.print(e);
}
}
void setup() {
- init_ace(115200, 20);
+ init_ace(9600, 200);
lcd.begin(16,2);
lcd.clear();
lcd.print("ready");
@@ -33,12 +34,7 @@ void setup() {
uint8_t i = 0;
void loop() {
-
- lcd.clear();
- lcd.print("|");
-
-
delay(1000);
+ i += 1;
ace_send0(1, &i);
- delay(1000);
}
diff --git a/specification/specification.pdf b/specification/specification.pdf
index fca8672..08412f9 100644
--- a/specification/specification.pdf
+++ b/specification/specification.pdf
Binary files differ
diff --git a/specification/specification.tex b/specification/specification.tex
index e15f517..854391b 100644
--- a/specification/specification.tex
+++ b/specification/specification.tex
@@ -101,8 +101,8 @@ An invalid frame should be ignored by the receiver and no action taken.
Structure & Header & Data & \multicolumn{2}{|c|}{Trailer} \\ \hline \hline
Detailed structure & start & data & checksum & stop \\ \hline
Length (bytes) & 1 & any (within limits of implementation) & 1 & 1 \\ \hline
- Hexadecimal values & 0x02 & & XOR of all data bytes & 0x10 \\ \hline
- \multicolumn{5}{l}{Escape byte value: 0x03.} \\
+ Hexadecimal values & 0x02 & & XOR of all data bytes & 0x03 \\ \hline
+ \multicolumn{5}{l}{Escape byte value: 0x10.} \\
\end{tabular}
\caption{A data frame in ACE.}
@@ -113,13 +113,13 @@ An invalid frame should be ignored by the receiver and no action taken.
\subsection{Example 1}
As a first example, consider the message ``hello'' encoded in ASCII. Equivalently, this message may be represented as a sequence of bytes (in decimal representation): \begin{verbatim} 104 101 108 108 111 \end{verbatim}
The checksum of this message is 98, therefore the corresponding data frame is:
-\begin{verbatim} 002 104 101 108 108 111 098 016 \end{verbatim}
+\begin{verbatim} 002 104 101 108 108 111 098 003 \end{verbatim}
\subsection{Example 2}
As a second example, consider the byte sequence:
-\begin{verbatim} 001 108 002 111 003 102 \end{verbatim}
-The values 002 and 003 are special bytes and therefore have to be escaped. Considering that the checksum is 101, the resulting frame is given by:
-\begin{verbatim} 002 001 108 003 002 111 003 003 102 101 016 \end{verbatim}
+\begin{verbatim} 001 108 002 111 016 102 \end{verbatim}
+The values 002 and 016 are special bytes and therefore have to be escaped. Considering that the checksum is 118, the resulting frame is given by:
+\begin{verbatim} 002 001 108 016 002 111 016 016 102 118 003 \end{verbatim}
\section{Automatic Repeat Request (ARQ)}
To remedy the loss of invalid frames, ACE uses a kind of stop-and-wait ARQ. After sending a frame, the sender waits for an acknowledgement of the receiver before transmitting a next frame. If no acknowledgement is received in a timeout delay, the message is retransmitted. If after retransmitting the message several times no acknowledgement has been received, the message is considered to have been lost and an error is generated at the sender side. Only if the correct acknowledgement is received the message may be considered successfully sent and an action may be taken.