UAT 105 Digital Technology and Networks

Worksheet 1 Reading a drone's bits

Analysis activity 6 hAssesses CLO1

Objective

Read and interpret the bytes of real MAVLink frames, build an adder from gates and check the CRC of a whole file

Equipment and materials

  • Computer with Python and pymavlink
  • telemetry_sample.tlog from UAT 104
  • MAVLink common.xml documentation
  • Module 1 example code

Safety

  • Desk work only; no flying

Steps

  1. Read the first 40 bytes with open(..., "rb") and pick out the first frame's length, sequence, system ID and message ID by hand
  2. Write a function that turns base_mode into the names of all 8 flags from common.xml
  3. Build an 8-bit adder from full_adder
  4. Test the adder on every pair 0–255 against (x + y) % 256
  5. Get each message's CRC_EXTRA from pymavlink
  6. Check every frame's CRC with crc16_mcrf4xx and count the mismatches

Record of results

Table 1 Header of the first frame in telemetry_sample.tlog
FieldByte positionHex valueDecimal valueMeaning
Table 2 Test results of the base_mode decoder and the 8-bit adder
TestInputExpected resultResult obtainedMatch?
Table 3 CRC check of every frame by message type
Message IDMessage nameCRC_EXTRAFramesFrames with bad CRC

Questions

  1. The first 8 bytes of the file come before 0xFD. What are they, what time do they give when read big-endian, and why are they not part of the MAVLink frame?

  2. Which base_mode value appears most often in the file, which flags does it decode to, and what does that say about the drone's state while it was recorded?

  3. How many of the 65,536 pairs gave a carry of 1 in your 8-bit adder? How does the sum in those pairs relate to (x + y) % 256, and how does this connect to MAVLink's 8-bit sequence counter?

  4. If no frame had a bad CRC, can you conclude that nobody forged a message in the file? Explain using how a CRC works.

Check before you hand in

What to hand in

  • Table of the first frame header
  • Flag decoder and adder code with test results
  • Number of bad-CRC frames with code

CLO1 Explain digital systems and basic computer architecture. (CLOs are a web-team draft; the course owner sets the final ones.)

Instructors: answers and teaching notes for this worksheet are in the teaching pack