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: For example, a battery sensor sending short binary frames over RS-485 might choose a CRC and a retry limit because noise, termination problems, and cable faults are the dominant failure modes.
- 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.
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
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 View It 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.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
Wider usually lowers random collision probability, but width alone is not the full definition.
- A reflected CRC implementation processes least-significant bits first; a non-reflected implementation processes most-significant bits first.
- Selection also depends on what the protocol is trying to defend against.
- Assuming one clean demo represents field behavior.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
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.
- 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.
- A mismatch here makes both sides disagree even on clean bytes.
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.
- 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.
- Explicit accept, drop, retry, or escalate policy.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
Byte order The 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 Method The 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
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
Those cases expose whether the implementation protects the intended byte range and whether the receiver rejects cleanly before any application action runs.
- For example, a battery sensor sending short binary frames over RS-485 might choose a CRC and a retry limit because noise, termination problems, and cable faults are the dominant failure modes.
- A firmware-update channel should not rely on that same CRC to accept code: it still needs a signed image or authenticated transport because the consequence is executing attacker-controlled bytes.
- Using a CRC where a keyed integrity tag is required.
Major section
Under the Hood: CRC Parameters, Selection, and Residual Risk (continued)
The review question is not "which check value is strongest in isolation?" but "which failure can pass this check, and what layer catches it next?".
- Common Pitfalls Verifying the wrong bytes.: Do not compute over a decoded value, an omitted field, or an already-stripped region unless the protocol says so.
- Naming only CRC-16 or CRC-32.: The width is not enough; record polynomial, initial value, reflection, final XOR, and byte order.
- Forgetting recovery.: A receiver that detects corruption but has no drop, retry, quarantine, or alarm policy still has an incomplete design.
Major section
Summary
CRCs are stronger for accidental corruption, but only when both sides use the same variant and protected-byte scope.
- A CRC is defined by width, polynomial, initial value, reflection, final XOR, and byte order, not by its name alone.
- Detection is not correction; the protocol still needs a recovery action on failure.
- 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.
- 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.
- That blind spot is exactly why stronger links use a CRC, whose result depends on bit position and order.
Retrieval practice
Recall check 1 of 3

Physics Phoebe says: answer from memory, then check your reasoning.
Q1A 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: A Addition is commutative, so swapping two bytes preserves the same sum and the checksum does not notice the change.
Retrieval practice
Recall check 2 of 3

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

Physics Phoebe says: answer from memory, then check your reasoning.
Q3An 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: B An attacker can recompute a CRC after modifying the data, so width does not add authenticity.
Print reference
Answers
Answer key.
- A · Addition is commutative, so swapping two bytes preserves the same sum and the checksum does not notice the change.
- C · CRC is a family of algorithms; these parameters define how both sides compute and compare the value.
- B · An attacker can recompute a CRC after modifying the data, so width does not add authenticity.