Bird
0
0

How would you modify the message structure and checksum calculation?

hard🚀 Application Q9 of 15
Raspberry Pi - Serial UART Communication
You want to extend a serial protocol to include a command byte after the start byte and before the payload. The start byte is 0x01, command byte is 1 byte, payload is variable length, and end byte is 0x04. How would you modify the message structure and checksum calculation?
AMessage = start + payload + command + checksum + end; checksum covers entire message including start and end
BMessage = start + command + payload + end + checksum; checksum covers command and payload
CMessage = command + start + payload + checksum + end; checksum covers payload only
DMessage = start + command + payload + checksum + end; checksum covers command and payload bytes only
Step-by-Step Solution
Solution:
  1. Step 1: Define message structure with command byte

    Start byte first, then command byte, then payload, checksum, and end byte last.
  2. Step 2: Determine checksum coverage

    Checksum typically covers command and payload to detect errors in data, excluding framing bytes.
  3. Final Answer:

    Message = start + command + payload + checksum + end; checksum covers command and payload bytes only -> Option D
  4. Quick Check:

    Checksum excludes framing bytes, includes command and payload [OK]
Quick Trick: Checksum covers command and payload, not start/end bytes [OK]
Common Mistakes:
MISTAKES
  • Including start/end bytes in checksum
  • Placing checksum after end byte
  • Mixing order of command and payload

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes