Qt 6 Threads, Network/Serial/CAN Buses, SQLite WAL & Cross-Target Packaging

For: Embedded Linux and C++20 engineers connecting Qt 6 HMIs to field buses, sockets, board peripherals, sensors, and cross-compiled ARMv7-A targets

Build non-blocking Qt 6.8 industrial HMIs interfacing cleanly with worker threads, TCP/UDP/HTTP sockets, Linux LEDs/GPIO/PWM/evdev, RS-485/Modbus/NMEA/SocketCAN, IIO/SPI sensors, SQLite3 WAL databases, and cross-compiled ARMv7-A sysroots.

18 lessons6 labs~16h 30mLinux 6.12Course 2 of 4 · Concurrency, Industrial Buses, SQLite WAL & Cross-Deployment

What you'll build

lab m0170 min

Lock-Free SPSC Worker-to-GUI Sensor Bridge & Coalesced Wakeups

Enforce the Qt 6 GUI-thread affinity invariant across QThread subclasses and unparented worker QObjects, eliminate cross-thread BlockingQueuedConnection deadlocks, and bridge 10 kHz sensor streams into 60 Hz UI frames using cache-aligned C++20 SPSC atomic rings with coalesced wakeups.

learner@ksa: ~/gl-q02/lab-m01
learner@ksa:~/gl-q02/lab-m01./files/lab_clispsc_cli: wakes=1 n1=8 rearm1=1 n2=12 rearm2=0 drops=0learner@ksa:~/gl-q02/lab-m01
lab m0275 min

Streaming TCP CRC32 Frame Resync & UDP Multicast Sequence Tracker

Inspect embedded NICs with QNetworkInterface, reassemble arbitrary-chunk QTcpSocket byte streams with length+CRC32 state machines, receive unicast/broadcast/multicast QUdpSocket telemetry with sequence-gap tracking, and harden QNetworkAccessManager HTTP downloads with Range resume and backoff.

learner@ksa: ~/gl-q02/lab-m02
learner@ksa:~/gl-q02/lab-m02./files/lab_cliframing_cli: tcp_frames=2 udp_accepted=3 late=1 dup=1 gaps=1learner@ksa:~/gl-q02/lab-m02
lab m0375 min

Non-Blocking evdev KEY0 Assembler, Safe PWM Sequencer & Fault Debouncer

Control embedded Linux /sys/class/leds indicators, gpio-leds buzzers, and /dev/gpiochipN v2 lines with desktop simulation fallback, capture board KEY0 (code 114 / Key_VolumeDown) via both QWidget events and focus-independent QSocketNotifier evdev descriptors, and sequence glitch-free PWM ramps.

learner@ksa: ~/gl-q02/lab-m03
learner@ksa:~/gl-q02/lab-m03./files/lab_clihw_cli: evdev_rc=0 pkts=1 key0_down=1 pwm_steps=2 fault_latched=1learner@ksa:~/gl-q02/lab-m03
lab m0475 min

UART3 Modbus RTU CRC-16 to SocketCAN Frame Router & Bitrate Gate

Bind non-console embedded UARTs (/dev/ttymxc2) in raw 8N1 mode with Modbus RTU 0xA001 CRC-16 framing, parse NMEA-0183 GNSS streams in zero heap allocations with monotonic stale-fix watchdogs, and route Linux SocketCAN (can0) frames across kernel filter masks and Bus-Off recovery states.

learner@ksa: ~/gl-q02/lab-m04
learner@ksa:~/gl-q02/lab-m04./files/lab_clirouter_cli: busy_rc=-16 applied_bps=500000 can_id=0x204 len=4 matched=1learner@ksa:~/gl-q02/lab-m04
lab m0580 min

SQLite3 WAL Sensor & Alarm Store With Atomic Rollback & Composite Keyset Pagination

Acquire AP3216C (I2C) environmental and ICM-20608 (SPI) 6-axis inertial telemetry from non-GUI Qt worker objects, persist alarm schedules and batched sensor streams in thread-confined SQLite3 WAL databases, and render 100,000-row history views without UI stalls via composite keyset pagination.

learner@ksa: ~/gl-q02/lab-m05
learner@ksa:~/gl-q02/lab-m05./files/lab_cliwal_store_cli: mode=wal index=1 p1_rows=64 alarms=1learner@ksa:~/gl-q02/lab-m05
lab m0685 min

Capstone Project: ARMv7-A Sysroot Toolchain, CJK/ELF Bundle Auditor & GUI-Gated NOTIFY_SOCKET

Cross-compile Qt 6.8 C++20 applications for ARMv7-A Cortex-A7 hard-float sysroots with QT_HOST_PATH and rsync remote gdbserver workflows, subset CJK/UTF-8 fonts and plugins with relocatable ELF DT_RUNPATH tags, and replace legacy demo launchers with hardened systemd Type=notify HMI units.

learner@ksa: ~/gl-q02/lab-m06
learner@ksa:~/gl-q02/lab-m06./files/lab_clicapstone_manifest_cli: verdict=0 artifacts=4 cjk_strings=1learner@ksa:~/gl-q02/lab-m06

Syllabus

gl-q02/

  • m01/ GUI-Thread Affinity, QThread Workers & Lock-Free SPSC Rings

    Enforce the Qt 6 GUI-thread affinity invariant across QThread subclasses and unparented worker QObjects, eliminate cross-thread BlockingQueuedConnection deadlocks, and bridge 10 kHz sensor streams into 60 Hz UI frames using cache-aligned C++20 SPSC atomic rings with coalesced wakeups.

  • m02/ Non-Blocking QTcpSocket, QUdpSocket Multicast & HTTP Clients

    Inspect embedded NICs with QNetworkInterface, reassemble arbitrary-chunk QTcpSocket byte streams with length+CRC32 state machines, receive unicast/broadcast/multicast QUdpSocket telemetry with sequence-gap tracking, and harden QNetworkAccessManager HTTP downloads with Range resume and backoff.

  • m03/ Embedded Linux LED, Buzzer, USER-KEY (evdev) & PWM HMI Control

    Control embedded Linux /sys/class/leds indicators, gpio-leds buzzers, and /dev/gpiochipN v2 lines with desktop simulation fallback, capture board KEY0 (code 114 / Key_VolumeDown) via both QWidget events and focus-independent QSocketNotifier evdev descriptors, and sequence glitch-free PWM ramps.

  • m04/ QSerialPort (UART3), GNSS Streaming & QCanBus SocketCAN

    Bind non-console embedded UARTs (/dev/ttymxc2) in raw 8N1 mode with Modbus RTU 0xA001 CRC-16 framing, parse NMEA-0183 GNSS streams in zero heap allocations with monotonic stale-fix watchdogs, and route Linux SocketCAN (can0) frames across kernel filter masks and Bus-Off recovery states.

    • Enumerate QSerialPortInfo::availablePorts() to bind dedicated peripheral UART3 (/dev/ttymxc2) while avoiding /dev/ttymxc0 kernel console contention. Configure QSerialPort in raw 115200 8N1 mode with NoFlowControl and kernel TIOCSRS485 turnaround so binary 0x11 and 0x13 bytes transmit transparently. Reassemble fragmented readyRead() UART bursts across silent inter-frame intervals and verify reflected-polynomial 0xA001 Modbus RTU CRC-16 trailers.

    • Validate NMEA-0183 hexadecimal XOR checksums strictly across characters between $ and * before trusting any telemetry field. Tokenize comma-delimited GNSS sentences in zero heap allocations with C++20 std::string_view while preserving empty cold-start ,, columns. Convert ddmm.mmmm coordinates into signed 1e-7-degree fixed-point integers and expire stale fixes using a CLOCK_MONOTONIC watchdog.

    • Explain why Linux SocketCAN requires ip link set can0 down before changing bitrate (ip link set can0 up type can bitrate 500000) and how QCanBus('socketcan', 'can0') attaches. Pack classical 8-byte QCanBusFrame / struct can_frame payloads and configure kernel CAN_RAW_FILTER masks isolating 11-bit SFF, 29-bit EFF, and RTR frames. Diagnose CAN 2.0B TEC/REC fault-confinement transitions (Error-Passive at 128, Bus-Off at TEC >= 256) and verify the dual-bus gateway lab.

  • m05/ AP3216C & ICM-20608 Sensor Interfaces and QtSql SQLite3 WAL

    Acquire AP3216C (I2C) environmental and ICM-20608 (SPI) 6-axis inertial telemetry from non-GUI Qt worker objects, persist alarm schedules and batched sensor streams in thread-confined SQLite3 WAL databases, and render 100,000-row history views without UI stalls via composite keyset pagination.

  • m06/ ARMv7-A Cross-Compilation, Qt Creator Kits & Target Deployment

    Cross-compile Qt 6.8 C++20 applications for ARMv7-A Cortex-A7 hard-float sysroots with QT_HOST_PATH and rsync remote gdbserver workflows, subset CJK/UTF-8 fonts and plugins with relocatable ELF DT_RUNPATH tags, and replace legacy demo launchers with hardened systemd Type=notify HMI units.

Prerequisites

  • requiredGL-Q01 (or equivalent): QObject ownership trees, signal/slot meta-calls, and ISO C++20 RAII fluency
  • requiredLinux file descriptors, non-blocking I/O fundamentals, and basic POSIX socket or serial terminology
  • Bridged in M1–M2Enforces GUI-thread affinity, worker moveToThread() vs QThread subclassing, lock-free SPSC rings, and framed TCP/UDP/HTTP networking (Modules 1–2)
  • Bridged in M3–M6Integrates board LEDs, GPIO/BEEP, PWM, evdev USER-KEY (code 114), UART3 QSerialPort, FlexCAN SocketCAN, AP3216C/ICM-20608 sensors, SQLite3 WAL, and CMake/Qt Creator rsync cross-debugging (Modules 3–6)

Series map

  1. GL-Q01Modern C++20 Foundations, QObject Meta-Object Internals & Qt 6 Widgets — C++20 RAII/move & ownership, CMake AUTOMOC, moc QMetaObject dispatch, event loops/timers, box/grid layouts, Model/View roles, QPainter & QTest
  2. GL-Q02Qt 6 Threads, Network/Serial/CAN Buses, SQLite WAL & Cross-Target Packaging — GUI-thread affinity, worker moveToThread & SPSC rings, QTcpSocket/QUdpSocket/HTTP, sysfs/gpiod/evdev/PWM, QSerialPort/SocketCAN, SQLite3 WAL & CMake sysroots this course
  3. GL-Q03Qt Quick / QML Scene Graph, Wayland/DRM-KMS, Multimedia & Industrial HMI — QQmlApplicationEngine & QML_ELEMENT bindings, Controls 2/SwipeView/ListView pooling, QSGNode/QRhi batching, eglfs_kms & Wayland QPA, V4L2/ALSA & watchdog HMI
  4. GL-Q04Embedded OpenCV 4 Vision, USB Bluetooth, Voice/IoT & Video Surveillance Projects — ARMv7 NEON OpenCV 4 cross-builds & YUYV camera capture, BlueZ QtBluetooth RFCOMM, Smart-Home IoT gateways, 16 kHz WAV ASR, License-Plate OCR & UDP video streaming

Related live cohorts: EMB-100 · Embedded Linux: Toolchain to Product (live cohort) DRV-120 · Linux Device Drivers (live cohort)

Companion formats

Slide deck

16:9 review slides with terminal listings, diagrams, and speaker notes.

Reference handbook

Printable HTML and PDF engineering reference covering every module and UAPI.

Flashcards

Leitner spaced-repetition terminal cards and TSV deck for syscalls, flags, and pitfalls.

Kernel Systems Academy engineering studio

Every Kernel Systems Academy course follows our 35% principles / 20% guided investigation / 45% engineering studio pedagogy. Listings are compiled against Linux 6.12 under strict compiler flags (-Wall -Wextra -Werror), and each module culminates in an evidence-checked lab graded locally by ./check.sh.

Frequently asked questions

Can I study this course offline from disk?

Yes. All fonts, stylesheets, diagrams, search indexes, and progress trackers use relative paths and local browser storage, so the bundle works identically over HTTP and file://.

How are the hands-on labs graded?

Each lab directory includes starter source files and an executable ./check.sh runner emitting TAP version 13 diagnostics (ok / not ok) and exiting 0 when every check passes.

What is included in the free preview?

Preview lessons and the opening module lab are unlocked in full so you can inspect our C11 listings, strace transcripts, and ./check.sh workflow before subscribing.

search — fzf

0/0 ───────────────────────────────────────────

keyboard shortcuts — less

/
search
f
focus mode
[
previous
]
next
?
help
Esc
close

figure