Module 2/5 · Weeks 4–6 · 27 h

Computer architecture

UAT 105 Digital Technology and Networks

About 90 minDraft, awaiting reviewLast updated 30 September 2026

Lesson

By the end of this module you will be able to

  1. Describe the parts of a von Neumann computer and the fetch–decode–execute cycle
  2. Explain the memory hierarchy and interrupts in systems that must respond on time
  3. Compare the flight controller with the companion computer on a drone
  4. Choose UART, I²C, SPI or CAN for a device, and calculate bus and storage capacity
  5. Explain what an operating system does, processes, threads, scheduling and file systems, and use basic Linux command-line commands

Prerequisites: UAT 105 module 1

Why this matters

A drone carries at least one computer that must read sensors hundreds of times a second and command the motors on time. Pick the wrong board, wire a device to the wrong bus, or use a memory card that cannot write fast enough, and video stutters or logs are lost. At worst, the control system reacts too late to keep the aircraft stable. Understanding computer architecture lets you read board specifications and design a system with enough resources.

The von Neumann computer

Almost every computer, from the microcontroller in a flight controller to a cloud server, has the same main parts:

  • The central processing unit (CPU), made of a control unit that fetches and decodes instructions, an arithmetic logic unit (ALU) built from the adders and gates of module 1, and registers, tiny memories that are the fastest of all
  • Memory, which holds both program instructions and data
  • Input/output (I/O) devices such as sensors, motor drivers and radios
  • Buses, the signal lines linking everything, split into address, data and control buses
A CPU box on the left contains the control unit, the ALU, and registers with the clock. On the right are memory holding both instructions and data, and input/output devices such as sensors, motors and radio. Along the bottom a bus carrying address, data and control signals links every part
Figure 1 The von Neumann architecture

The CPU runs an endless cycle: fetch an instruction from memory, decode it, then execute it. The clock sets the pace. A 480 MHz clock ticks 480 million times a second.

The width of the address bus sets how many memory locations it can point to. A 32-bit system addresses locations; at one byte each, that is 4 GiB.

clock_hz = 480e6
print(f"clock period {1e9 / clock_hz:.3f} ns")
print(2**32, "addresses =", 2**32 / 2**30, "GiB")
clock period 2.083 ns
4294967296 addresses = 4.0 GiB

The memory hierarchy and interrupts

Fast memory is expensive and small, so memory is arranged in layers: registers inside the CPU (fastest, smallest) → cache → RAM, the main memory that is lost when power goes off → persistent storage such as flash, SD cards or SSDs, which is large but slowest. Fast programs keep the data they need in the upper layers as much as possible.

A flight controller must react immediately, for instance when the IMU has a new sample ready. Having the CPU keep asking the device (polling) wastes cycles, so devices raise an interrupt: a signal that makes the CPU pause its current work to run a short urgent task first. A real-time operating system such as NuttX, which PX4 uses on flight controllers, schedules tasks by priority so that flight control is never blocked by other work.

The two computers on a drone

Modern drones often split work between two kinds of computer.

Flight controllerCompanion computer
ExamplePixhawk 6XRaspberry Pi 5
ProcessorSTM32H753 Arm Cortex-M7 480 MHzBroadcom BCM2712 quad-core Arm Cortex-A76 2.4 GHz
Memory2 MB flash, 1 MB RAMLPDDR4X 1–16 GB
Operating systemReal-time OS (NuttX)Linux
RoleRead sensors, estimate state, drive motorsImage processing, AI, mission planning, networking
StrengthGuaranteed, timely responseLots of computing power and software

The flight controller has only 1 MB of RAM, which is enough for its specialised job. The Raspberry Pi 5 is many times faster, but Linux does not guarantee response times, so it should not drive the motors directly. The two computers talk MAVLink over UART or Ethernet.

The flight controller, STM32H753 at 480 MHz, sits in the middle. It reads the IMU and barometer over SPI, GNSS over UART and the telemetry radio over UART, sends PWM or DShot signals to the ESCs and motors, and talks MAVLink with the Raspberry Pi 5 companion computer over UART or Ethernet. The companion computer takes images from the camera over USB or CSI
Figure 2 The two computers on a drone and their buses

On-board buses

BusWiresCharacterUsed for
UART2 (TX, RX)No shared clock; both sides set the same baud rate; point to pointGNSS, telemetry radio, companion computer
I²C2 (SDA, SCL)Several devices on one line, selected by address; moderate speedCompass, rangefinder, small display
SPI4 or moreShared clock, fast, a separate select line per deviceIMU, barometer, memory
CAN2 (twisted pair)Differential signalling, resists noise, message priorityDroneCAN ESCs and GNSS

8N1 UART sends one byte as 1 start bit, 8 data bits and 1 stop bit, 10 bits in total. At 57600 baud it can carry at most 5760 bytes per second.

Example 1 How many position messages can a telemetry radio send per second?

A GLOBAL_POSITION_INT message has 28 bytes of payload plus 12 bytes of MAVLink 2 header and CRC (unsigned), at most 40 bytes per frame.

baud = 57600
bytes_per_s = baud / 10
frame_bytes = 28 + 12
print(bytes_per_s, "byte/s")
print(bytes_per_s / frame_bytes, "GLOBAL_POSITION_INT frames/s at most")
5760.0 byte/s
144.0 GLOBAL_POSITION_INT frames/s at most

This is the theoretical ceiling of one link. In practice the link is shared with many other messages, such as HEARTBEAT, ATTITUDE and SYS_STATUS, and you need margin for periods when noise corrupts messages, so choose message rates that leave spare capacity.

Storage and write speed

A survey drone records both flight logs and video. You must check both capacity (how long it can record) and write speed (whether it keeps up with incoming data). The SD Association defines the Video Speed Class, where the number on the symbol gives the minimum write speed; V30 means 30 MB/s.

Example 2 Can a 128 GB V30 card take the video?

Suppose the camera records 4K video at 150 Mbit/s and the flight controller writes a 50 kB/s log.

log_rate_bytes = 50_000
print(log_rate_bytes * 3600 / 1e6, "MB of log per hour")

video_mbps = 150
video_mb_per_s = video_mbps / 8
print(video_mb_per_s, "MB/s needed, fits V30:", video_mb_per_s <= 30)

card_gb = 128
minutes = card_gb * 1e9 * 8 / (video_mbps * 1e6) / 60
print(f"{minutes:.1f} min of video on {card_gb} GB")
180.0 MB of log per hour
18.75 MB/s needed, fits V30: True
113.8 min of video on 128 GB

The video needs 18.75 MB/s, below the 30 MB/s minimum of V30, so the card keeps up, and 128 GB records about 114 minutes, enough for several batteries. If the camera is set to a higher bit rate such as 300 Mbit/s (37.5 MB/s), you need V60 or better.

Introductory operating systems

An operating system (OS) is the software between the hardware and all other programs. Like a building manager, it shares out CPU time and memory, looks after files and controls access to devices, so that many programs can use one machine without fighting over it and crashing. The core of the OS is the kernel, which runs with the highest privileges; ordinary programs run with limited privileges and must ask the kernel for services, such as reading a file.

A drone has three levels. Some small microcontrollers have no OS at all (bare metal): one program simply loops forever. The flight controller uses a real-time operating system (RTOS) such as NuttX, which is small and focused on predictable timing. The companion computer uses a general-purpose operating system such as Linux, which aims to run many kinds of work and share resources fairly.

Processes and threads

A process is a running program. The program itself is just a file of instructions sitting on disk; when the OS loads it and runs it, it becomes a process. Each process has its own memory area (address space), so one process crashing does not corrupt another’s memory. On a companion computer, for example, the image-processing program and the MAVLink forwarding program are separate processes.

Inside a process, work can be split further into parts that run concurrently, called threads. Threads in the same process share memory, which makes communication easy but means care is needed so they do not overwrite each other’s data. A process is in one of three main states: running on the CPU, ready and waiting in the CPU queue, or blocked, for example waiting for data from a UART or for an SD card write to finish.

Scheduling

One CPU core can execute only one process at a time, yet we see many programs running together, because the OS scheduler switches between them very quickly. Each switch is a context switch: saving the registers of the old task and loading those of the new one, which wastes a little time every time. Two scheduling approaches to know:

  • Round robin gives each task an equal short turn, called a time slice, then switches to the next task in the queue. It is fair and keeps users’ programs responsive; it is the idea behind general-purpose operating systems.
  • Preemptive priority lets a more important task interrupt a less important one at once. An RTOS uses this so that flight-control tasks meet their deadline every cycle. ArduPilot also has its own scheduler that states how many times per second each task runs and the longest time it may take.

Always check the CPU utilisation. If task runs times per second and takes seconds each time, total utilisation is . If the CPU certainly cannot keep up, and some headroom must be left for irregular work. Strict checks that every task meets its deadline are taught in UAT 204.

Example 3 Can the flight controller take on another task?

A flight controller’s task table (assumed values, in the same form as ArduPilot’s task table, which gives each task’s rate and time used). The team wants to add an image-processing task at 20 times per second, 15 ms each time.

tasks = [("rate control", 400, 600), ("EKF", 400, 900), ("logging", 50, 1500), ("telemetry", 50, 1000), ("GPS", 10, 2000)]


def utilisation(task_list):
    return sum(hz * us * 1e-6 for _, hz, us in task_list)     # U = sum of rate x time used


for name, hz, us in tasks:
    print(f"{name:<13}{hz:>4} Hz {us:>6} us  U = {hz * us * 1e-6:.3f}")
u = utilisation(tasks)
print(f"total U = {u:.3f}, idle {1 - u:.1%}")
u2 = utilisation(tasks + [("vision", 20, 15000)])
print(f"with vision task U = {u2:.3f}, overloaded: {u2 > 1}")
rate control  400 Hz    600 us  U = 0.240
EKF           400 Hz    900 us  U = 0.360
logging        50 Hz   1500 us  U = 0.075
telemetry      50 Hz   1000 us  U = 0.050
GPS            10 Hz   2000 us  U = 0.020
total U = 0.745, idle 25.5%
with vision task U = 1.045, overloaded: True

The existing tasks use 74.5% of the CPU, and the 400 Hz tasks have only ms per cycle. Adding image processing pushes utilisation above 100%, so flight-control tasks would start missing cycles. This is why image work belongs on the companion computer, as in the section on the two computers on a drone.

On the companion computer using round robin with 3 processes, a 10 ms time slice and a 1 ms context switch (assumed), the time lost to switching is , and each process waits ms before it gets the CPU again. That is fine for image work but far too slow for a control loop that needs to run every 2.5 ms.

File systems

A file system is how the OS organises data on permanent storage into named files, grouped in directories (folders) nested in a tree. A file’s location is written as a path. On Linux it starts from the root /, such as /home/pi/logs/flight01.bin, an absolute path; logs/flight01.bin is a relative path, counted from the current directory. Windows uses drive letters and \, such as C:\drone\logs.

Each file system has different limits. Under the SD Association standards, SDHC cards (over 2 GB up to 32 GB) use FAT32 and SDXC cards (over 32 GB up to 2 TB) use exFAT, while Windows mainly uses NTFS. A limit often met in drone work is that FAT32 can hold a single file of at most 4 GiB, so a camera recording to a FAT32 card must split video into several files. exFAT and NTFS have no such practical limit.

Example 4 How many minutes per video file?

The camera in Example 2 records at 150 Mbit/s onto a card formatted as FAT32, so one file can be at most 4 GiB.

  1. 4 GiB bytes bits
  2. Time per file: s, about 3.8 minutes
  3. A 20-minute flight therefore gives about 6 video files, which the image-processing software must order and join correctly. A 128 GB card is SDXC; kept in its standard exFAT format, it does not need to split files for this reason.

The command line

A companion computer on a drone usually has no screen, so operators control it through the command line, where a program called the shell accepts text commands, often over a remote SSH connection. Basic Linux commands to know well:

CommandWhat it doesExample
pwdshow the current directorypwd
ls -llist files with size, date and permissionsls -l logs
cdchange directorycd /home/pi/logs
mkdirmake a directorymkdir flight01
cp and mvcopy, and move or renamecp log.bin backup/
rmdelete a file (no recycle bin: it is gone)rm old.bin
ps auxlist all running processesps aux
topcontinuously show the processes using the most CPU and memorytop
df -hshow free space on each file systemdf -h
free -hshow memory used and freefree -h

Each command’s manual opens with man command-name, for example man ps.

Activity: exploring the companion computer’s operating system

On a Raspberry Pi or Linux computer in the lab:

  1. Use pwd and then ls -l: which directory are you in, and which file is largest?
  2. Create a directory flight01, copy a sample file into it, then write both the absolute and the relative path of that file.
  3. Open top, then run a Python program that loops forever in another window. Watch the process rise to the top and note its CPU use, then stop it with Ctrl+C.
  4. Use df -h to find what percentage of the SD card is free, and calculate how many more minutes of 150 Mbit/s video it can hold.

Module lab

Lab: exploring computers and buses

  1. Read the Pixhawk 6X page in the PX4 user guide, list every port with its bus type (UART, I²C, CAN, internal SPI), and compare with Figure 2.
  2. On a Raspberry Pi or a Linux computer, run lscpu and free -h to see the cores, clock speed and RAM, and compare them with the flight controller.
  3. Start SITL following the knowledge unit on preparing a computer for a drone simulator, and see how much CPU and RAM the simulation uses.
  4. Work out the data budget of a 57600 baud telemetry radio sending HEARTBEAT at 1 Hz, ATTITUDE at 10 Hz and GLOBAL_POSITION_INT at 4 Hz. What percentage of capacity is used? (Find each payload size in MAVLink common.xml.)

Common mistakes

Watch out

  • Comparing clock speeds across architectures: different CPU families do different amounts of work per tick
  • Letting a Linux computer drive the motors directly: Linux does not guarantee response times
  • Wiring TX to TX: UART lines must cross, TX of one side to RX of the other, with matching baud rates
  • Forgetting start and stop bits: 57600 baud UART carries 5760 bytes per second, not 7200
  • Looking only at card capacity: a card that writes too slowly drops video even when it has free space
  • Adding tasks to a flight controller without calculating CPU utilisation: if exceeds 1, control tasks miss cycles
  • Using rm without checking the path: the Linux command line has no recycle bin, and deleted logs are hard to recover

Summary

  • A von Neumann computer has a CPU, memory, I/O and buses; the CPU repeats fetch, decode and execute at the pace of the clock
  • Memory is layered from small and fast to large and slow, and interrupts let the system react on time
  • The flight controller focuses on timing guarantees, the companion computer on computing power; they talk MAVLink
  • The OS shares CPU time, memory and files among processes; an RTOS uses preemptive priority, a general-purpose OS uses time slices. Check CPU utilisation and know file-system limits, such as FAT32’s 4 GiB maximum file size
  • Match the bus to the device, and check the capacity and speed of both buses and storage before flight

Check your understanding

  1. What is the clock period of a 200 MHz CPU in nanoseconds?
  2. A flight controller runs a 100 Hz task taking 2 ms, a 50 Hz task taking 4 ms and a 10 Hz task taking 20 ms. What is the total CPU utilisation, and can it take more work?
  3. What is the maximum byte rate of 115200 baud 8N1 UART?
  4. Why does a flight controller use a real-time OS rather than Linux?
  5. A camera records video at 100 Mbit/s. How many minutes fit on a 64 GB card?
Answers
  1. ns
  2. , or 60%; 40% remains, but headroom must be kept rather than filling it completely
  3. byte/s
  4. Because flight-control tasks must be guaranteed to finish on time every cycle, and Linux does not give that guarantee
  5. s, about 85.3 minutes

Key formulas

Clock period
Addresses on an n-bit address bus
Byte rate of 8N1 UART
Recording time on a card of capacity C
CPU utilisation

Key references

  1. Harris, S. L., & Harris, D. (2021). Digital design and computer architecture: RISC-V edition. Morgan Kaufmann.
  2. PX4 Autopilot. Holybro Pixhawk 6X. PX4 user guide. link
  3. Raspberry Pi Ltd. Raspberry Pi 5 product specifications. link
  4. SD Association. Speed class standards for video recording. link
  5. MAVLink Development Team. Packet serialization. MAVLink developer guide. link
  6. Kurose, J. F., & Ross, K. W. (2025). Computer networking: A top-down approach (9th ed.). Pearson. link
  7. Arpaci-Dusseau, R. H., & Arpaci-Dusseau, A. C. (2023). Operating systems: Three easy pieces (Version 1.10). Arpaci-Dusseau Books. link
  8. Apache Software Foundation. Apache NuttX real-time operating system. link
  9. ArduPilot Dev Team. Scheduling code to run intermittently. ArduPilot developer documentation. link
  10. SD Association. Capacity (SD/SDHC/SDXC/SDUC). link
  11. Microsoft. File system functionality comparison. Microsoft Learn (Win32 apps). link
  12. Kerrisk, M. (Ed.). The Linux man-pages project: ps(1), df(1) and related command manuals. link

Further reading

Study the assigned knowledge units in advance, review media and take the module quiz

In class / field

Lab or field practice from worksheets with a safety checklist

Learning evidence: Checked worksheets and quiz results

Module quiz

This is a formative self-check, not a graded exam

Knowledge domain: Programming and digital technology · Mission planning, flight and simulation · Control, autopilot and navigation · Aircraft, structures and design · Installation, maintenance and testing · Electrical, electronics and power systems