IoT Fundamentals · Study deck
Packet Error Detection
Picture a temperature packet crossing a noisy link with one bit changed.
Physics Phoebe is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: A receiver ported from one microcontroller library to another can therefore reject every clean frame if the polynomial notation, reflection flags, initial register, final XOR, or output byte order silently changes.
- Explain: A gateway that crosses a security boundary needs a different layer: a keyed message authentication code, AEAD tag, or protocol-provided integrity check that an attacker cannot recompute without the key.
- Explain: A broken seal tells you something changed in transit, but it does not tell you what the contents should have been, and a maker could counterfeit the seal.
Major section
In 60 Seconds
The resulting number may still look believable, so the receiver needs a defined check and a safe response.
- CRC means cyclic redundancy check, a calculation used to detect changed bits.
- JSON means JavaScript Object Notation, a readable text format for named data.
- A payload means the useful reading or command inside a message.
Major section
Start With the Story
You will choose an error check, define which bytes it covers, and decide what happens when validation fails.
- The first two panels show why a plausible value cannot prove that its bytes survived the link.
- The third adds a check over an exact packet range.
- The last rejects the bad copy and requests clean data.
Major section
What a Check Value Proves (and What It Doesn't)
A practical receiver also keeps the check value tied to the packet boundary.
- The important idea is to know the limits.
- A passing check gives the receiver evidence to accept, drop, retry, or escalate a frame.
- Deliberate tampering needs a keyed integrity tag, not a bigger CRC.
Major section
What a Check Value Proves (and What It Doesn't) (continued)
A framed link uses a CRC trailer; two devices that both say "CRC" still disagree unless the exact variant and protected range match.
- A broken seal tells you something changed in transit, but it does not tell you what the contents should have been, and a maker could counterfeit the seal.
- The One-Minute Check-Value ViewIt protects a byte range A record should always say exactly which bytes are covered: header, payload, length, or selected fields.
- If you can name what a check value proves and does not prove, you can stop here.
Major section
Apply It: Validate a Packet and Choose Recovery
The receiver should validate boundaries, scope, algorithm, and recovery in a repeatable order.
- Recompute locally: Use the captured bytes, not a decoded display value, to calculate the expected check.
- The checksum path adds byte values, so a byte swap can preserve the sum.
- The CRC changes for reorderings that leave the simple sum unchanged.
Major section
Apply It: Validate a Packet and Choose Recovery (continued)
That blind spot is exactly why stronger links use a CRC, whose result depends on bit position and order.
- The capability summary is a selection aid, not a substitute for recording the exact CRC variant, protected length, and recovery action.
- The sum is still 0x1A8 and the checksum still reads 0xA8, so the corrupted order passes.
- If you can validate a frame and choose recovery, you can stop here.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk
A CRC treats the protected bits as a polynomial and divides by a generator polynomial; the remainder becomes the check value.
- That makes the result sensitive to bit position and ordering, which is why a CRC catches many error patterns an addition checksum misses.
- But "CRC" alone is not a specification.
- Implementation details matter because many field failures are variant mismatches, not bad mathematics.
- A reflected CRC implementation processes least-significant bits first; a non-reflected implementation processes most-significant bits first.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
A wider CRC lowers accidental collision risk for a stated model, but it does not create trust.
- A receiver ported from one microcontroller library to another can therefore reject every clean frame if the polynomial notation, reflection flags, initial register, final XOR, or output byte order silently changes.
- Selection also depends on what the protocol is trying to defend against.
- A mismatch here makes both sides disagree even on clean bytes.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
Assuming one clean demo represents field behavior.
- A small sensor link that mainly sees random bit flips can often use a CRC plus retry because the receiver only needs to screen accidental corruption.
- A gateway that crosses a security boundary needs a different layer: a keyed message authentication code, AEAD tag, or protocol-provided integrity check that an attacker cannot recompute without the key.
- Explicit accept, drop, retry, or escalate policy.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
It should identify the CRC variant, the bytes covered, byte ordering on the wire, the comparison result, and the receiver action for mismatch.
- That record prevents a later port, library upgrade, or protocol bridge from changing one parameter while keeping the same label in the documentation.
- Wider usually lowers random collision probability, but width alone is not the full definition.
- Using a CRC where a keyed integrity tag is required.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
Byte orderThe transmitted check field needs a defined byte order so the receiver compares the same value.
- A useful review states what the chosen variant guarantees and what residual risk remains.
- Choosing a Check MethodThe choice is driven by the error model, frame length, failure consequence, and threat boundary.
- The bottom checksum example misses a byte swap, showing why a passing check cannot rule out every error.
Major section
Summary
Detection is not correction; the protocol still needs a recovery action on failure.
- The sender creates the check value, and the receiver repeats the same work before it accepts the frame.
- A checksum is cheap but can miss ordered changes that leave the sum intact.
- A CRC is not authentication; use a keyed integrity mechanism when deliberate modification is in scope.
Deck summary
Key takeaways
The resulting number may still look believable, so the receiver needs a defined check and a safe response.
- You will choose an error check, define which bytes it covers, and decide what happens when validation fails.
- A practical receiver also keeps the check value tied to the packet boundary.
- A framed link uses a CRC trailer; two devices that both say "CRC" still disagree unless the exact variant and protected range match.
- The receiver should validate boundaries, scope, algorithm, and recovery in a repeatable order.
Retrieval practice
Recall check 1 of 4

Physics Phoebe says: answer from memory, then check your reasoning.
Q1A receiver recomputes a frame check and gets a mismatch. The sender can retry. What should the receiver do?
Show answer
Answer: D A mismatch means this copy cannot be accepted; a retry can supply a clean copy.
Retrieval practice
Recall check 2 of 4

Physics Phoebe says: answer from memory, then check your reasoning.
Q2A packet uses an 8-bit addition checksum. The payload bytes 03 10 are received as 10 03. Why might the checksum still pass?
Show answer
Answer: D Addition is commutative, so swapping two bytes preserves the same sum and the checksum does not notice the change.
Retrieval practice
Recall check 3 of 4

Physics Phoebe says: answer from memory, then check your reasoning.
Q3Which information is needed to reproduce a CRC result from a packet capture?
Show answer
Answer: B CRC is a family of algorithms; these parameters define how both sides compute and compare the value.
Retrieval practice
Recall check 4 of 4

Physics Phoebe says: answer from memory, then check your reasoning.
Q4An engineer argues that upgrading from a 16-bit to a 32-bit CRC makes the link tamper-proof. What is the strongest correction?
Show answer
Answer: D An attacker can recompute a CRC after modifying the data, so width does not add authenticity.
Print reference
Answers
Answer key.
- D · A mismatch means this copy cannot be accepted; a retry can supply a clean copy.
- D · Addition is commutative, so swapping two bytes preserves the same sum and the checksum does not notice the change.
- B · CRC is a family of algorithms; these parameters define how both sides compute and compare the value.
- D · An attacker can recompute a CRC after modifying the data, so width does not add authenticity.