0

I am very sorry to not be able to provide code for this question but it is more of a logical situation. My termination sequence for the AX.25 protocol is "111111" which is six 1s. So if this sequence of 1s is found inside my data packet, it will denote the end of the packet file and send it without correctly sending the rest of the packet. I will do my best to explain my conclusions and test results such that you can understand my dilemma.

***Programming in Arduino******

byte 1 contains 8 bits. Look below and attempt to picture a byte in a rectangular box. right next to it is byte 2 which also contains 8 bits. Situation 1:

||_1_0_1_1_1_0_1_0_ ||_1_1_1_1_1_1_0_0_||

Attempted Solution 1: you could simply change 1 into 0 and keep track of it.

Situation 2:

||_1_0_1_1_1_0_1_1_ ||_1_1_1_1_0_0_1_0_||

Attempted Solution 2: attempted solution 1 breaks apart. and I am stuck here.

Individually the bytes are safe from activating AX.25 termination sequence but combined bytes results in a problem.

Here is a list of possible cases:

1) six 1s = termination sequence activated for end of packet

2) six 1s inside actual data of packet = premature termination

3) if 1s are changed to 0s than a sequence of six 0s can be a problem in reverting changes back

4) can only read 1 byte at a time (EEPROM) due to memory limitations

5) if six 1s occur between two bytes will also prematurely activate termination sequence.

Thank you in advance for any kind of help.

1 Answers1

0

The solution mandated by the ax.25 protocol is bit stuffing.

Conceptually, any time the receiver sees five sequential one bits and a zero bit, it assumes that the zero bit has been stuffed by the sender (to break up erroneous frame sequences in the data), and removes it before emitting the received data. The only sequence of six 1-bits that can have been sent un-stuffed is the framing sequence; all data will have been sent stuffed. The receiver must always de-stuff.

To stuff or unstuff will generally require a couple of bytes of working ram (or a couple of bytes of registers), although there might be creative ways around that.

To quote the official TAPR protocol standard:

"In order to ensure that the flag bit sequence mentioned above does not appear accidentally anywhere else in a frame, the sending station monitors the bit sequence for a group of five or more contiguous “1” bits. Any time five contiguous “1” bits are sent, the sending station inserts a “0” bit after the fifth “1” bit. During frame reception, any time five contiguous “1” bits are received, a “0” bit immediately following five “1” bits is discarded."

A google search for AX.25 bit stuffing should return as much detail as you might need.

Robert
  • 1