3

If I understand correctly both error detection/correction and framing are done at the link layer. I understand how popular error detection/correction and framing techniques work. But I struggle with the following: If we use for example bit stuffing to send frames over a link, how can we detect errors in the flag bits?

The problem is: If we only use error detection on the actual data bits and do bit stuffing after we add the correction bits then this would mean that we do not detect errors in the flag bits. So how would we do bit stuffing first and then add error detection bits?

Would you say the following works/is used? We use some fixed amount of error detection bits which we always append after the "end-flag" of some frame.

Would be grateful if someone could help me with this.

Edit: What is the intent of doing bitstuffing here? Assume I want to send a frame from one node to another. The physical layer provides an interface to send bit streams. So ultimately the receiving node receives a bit stream and must know how to convert it to single frames again. To achieve this the sending node uses bit stuffing on the frame and then sends the stuffed frame as bitstream. This allows the receiving node to find out where a frame starts and ends.

6
  • Are you referring to Ethernet, Wi-Fi or asking in general? What's the intent of bit stuffing?
    – Zac67
    Jun 8, 2019 at 10:35
  • I'm asking in general but it would be interesting to hear about how this is done in practice. Here the intent of bit stuffing is to perform framing. I'll edit my post to make it clearer what I mean.
    – sebastian
    Jun 8, 2019 at 10:45
  • 1
    Well, bit stuffing is done in the line code, belonging to the physical layer. Error detection differs, Ethernet does FCS in L2 and FEC in many faster L1 PHYs. I think you might rather be looking for a preamble/syncword. What is the PHY's line code?
    – Zac67
    Jun 8, 2019 at 11:46
  • Thanks for your comment. This helps alot. I probably had an oversimplified view about how things work. To summarize what I learn from your comment and looking up some of the terms: Error correction is done at L2 and often also at L1. The framing is often done using the preamble on L1 (This is different from what we learnt in class: We were told that on L2 frames would be put together to a bitstream). I was not thinking about a particular line code. Considering the things above: How bad would an error in the preamble be? Or what happens if there is an error in the preamble?
    – sebastian
    Jun 8, 2019 at 12:16
  • I think FEC is most reasonably done in L1 (where it is the most efficient) with simple error detection in L2 and possibly above. However, I'm afraid this is somewhat off-topic here, being about education and engineering...
    – Zac67
    Jun 8, 2019 at 13:51

1 Answer 1

2

The purpose of bit-stuffing is to ensure the data payload itself can never look like the begin/end flag that demarcs the payload. Yes any error correction stamp would be placed outside the data payload. Take for example SHA hashing on an IPSEC packet. the data payload is hashed-computed and then place outside the actual data payload. Bit stuffing is conventionally done where 5 bits of the same order occur in concession, a 6th bit is inserted afterward of the opposite order. This way the flag will always have at least 6 bits of the same order consecutively.

1
  • You can't error-correct with a SHA checksum. You need a hamming code or such.
    – Zac67
    Jun 8, 2019 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.