UART Console Framing (115200 8N1), Flow-Control Deadlocks & Boot-Mode Straps

Derive 8.68 us/bit 8N1 serial timing, diagnose why RTS/CTS freezes host TX on 3-wire consoles while RX prints normally, and decode i.MX6ULL BOOT_MODE and BOOT_CFG straps.

20 minfree previewLinux 6.12C11glibc 2.39→ module 5 lab
What you'll learn
  • Calculate 115200 8N1 bit-cell duration (8.68 us), frame throughput, and receiver oversampling clock-drift tolerance.
  • Diagnose asymmetric RX-works / TX-dead serial console hangs caused by CRTSCTS or IXON flags in POSIX termios.
  • Decode i.MX6ULL SRC_SBMR2 (BOOT_MODE[1:0]) and SRC_SBMR1 (BOOT_CFG1) register bitmasks to select USB SDP, SD, eMMC, or NAND boot.

Asynchronous 8N1 Timing and the Classic Frozen-Keyboard Trap

Your single umbilical cord during early board bring-up — long before Ethernet, USB, or LCD drivers exist — is UART1 running at 115200 8N1. Because UART has no shared clock wire, both ends agree ahead of time on 115,200 symbols per second (1 / 115200 s = 8.6806 us per bit). An idle line rests high (1); a falling edge starts 1 low Start bit, followed by 8 data bits (LSB b0 first), zero parity bits, and 1 high Stop bit — 10 bits (86.81 us) per byte, capping raw console throughput at 11,520 bytes/s.

Nearly every engineer hits the same baffling symptom on day one: U-Boot prints its countdown (Hit any key to stop autoboot: 3 2 1 0) crystal clearly, yet hammering the keyboard does nothing! Board debug headers route only 3 wires (TX, RX, GND) to the USB-TTL chip, leaving CTS# floating unasserted. When minicom defaults to Hardware Flow Control: Yes (CRTSCTS), the host USB-UART refuses to shift out TX bytes while still forwarding incoming RX bytes freely.

fig_m05_l01_a.svg — 3-wire debug consoles omit RTS#/CTS#; enabling CRTSCTS…

Figure 5.1a. 3-wire debug consoles omit RTS#/CTS#; enabling CRTSCTS blocks only host TX while target RX keeps streaming.

mental model: Think of RTS/CTS enabled on a 3-wire UART cable like a polite speaker waiting at a disconnected green talk-light button: you hear everyone in the room (RX) clearly, yet your microphone stays muted forever (TX) waiting for a wire nobody soldered.

Where it stops working: Disabling CRTSCTS fixes 3-wire debug consoles, whereas high-baud (3 Mbps) Bluetooth or cellular UART links genuinely require physical RTS#/CTS# traces to prevent FIFO overruns.

definition (BOOT_MODE & BOOT_CFG Strap Pins): Dual-purpose SoC pads (such as BOOT_MODE0/1 and LCD_DATA00..23 on the i.MX6ULL) whose weak pull-up/pull-down resistor or DIP-switch logic levels are latched once by the System Reset Controller into SRC_SBMR1 and SRC_SBMR2 on the rising edge of POR_B, telling the mask Boot ROM which boot media or USB recovery protocol to execute before pinmuxing.

ast_m05_l01.svg — Disable CRTSCTS on 3-wire 115200 8N1 consoles; set…step 1/4
  1. Step 1. Missing dialout membership returns EACCES on /dev/ttyUSB0 before baud configuration even runs.
  2. Step 2. Clearing both CRTSCTS and IXON prevents floating CTS# pins and stray 0x13 XOFF bytes from freezing TX.
  3. Step 3. Warm watchdog resets do not re-sample external LCD_DATA straps unless POR_B is asserted.
  4. Step 4. Reading SBMR1/SBMR2 directly catches stuck DIP switches or LCD peripheral pull-up contention.

Figure 5.1b. Disable CRTSCTS on 3-wire 115200 8N1 consoles; set BOOT_MODE=01 for USB SDP or 10 for flash boot.

i.MX6ULL Reset Strap Latches (SRC_SBMR1 and SRC_SBMR2)

When POR_B deasserts, the i.MX6ULL Cortex-A7 starts at 0x00000000 inside on-chip mask Boot ROM (96 KiB) and reads two read-only shadow registers in the System Reset Controller (SRC, base 0x020D8000): SRC_SBMR2 (+0x1C, where bits [25:24] hold latched BMOD[1:0] from BOOT_MODE1:0) and SRC_SBMR1 (+0x04, holding BOOT_CFG1, BOOT_CFG2, and BOOT_CFG4 latched from LCD_DATA00..23).

During development, boards expose BOOT_MODE[1:0] on a 2-pole DIP switch rather than burning one-time-programmable (OTP) eFUSEs (00). Setting BOOT_MODE = 01 forces the Boot ROM straight into USB_OTG1 HID Serial Downloader (SDP) even if flash holds a corrupted bootloader that hangs early! Setting BOOT_MODE = 10 selects Internal Boot and decodes BOOT_CFG1[7:4]: 0b010x boots SD (USDHC1), 0b011x boots eMMC (USDHC2), and 0b1xxx boots raw NAND via GPMI.

fig_m05_l01_b.svg — External LCD pins act as boot straps only during POR_B…

Figure 5.1b. External LCD pins act as boot straps only during POR_B assertion; if an attached LCD pulls them high, Internal Boot misroutes!

BOOT_MODE[1:0]BOOT_CFG1[7:4]Selected Boot PathEngineering Use Case
01 (SDP)IgnoredUSB_OTG1 HID Serial Downloader (15a2:0080)Blank-flash factory provisioning or unbricking hung U-Boot via UUU
10 (Internal)0b0100 / 0b0101SD / ESD card on USDHC1 (LBA 2, 0x400)Rapid daily bootloader & Device Tree iteration on removable card
10 (Internal)0b0110 / 0b0111eMMC managed flash on USDHC2 (boot0 / user)Soldered production storage with hardware FTL and boot0 partition
10 (Internal)0b1000..0b1111Raw SLC NAND flash on GPMI + BCH ECCCost-optimized 512 MiB raw flash using MTD + UBI/UBIFS
learner@ksa: ~/gl-e00/m05-l01
learner@ksa:~/gl-e00/m05-l01$ bat -H 14 -H 28 imx6ull_sbmr_uart.h File: imx6ull_sbmr_uart.h    /* SPDX-License-Identifier: GPL-2.0 */    #ifndef KSA_IMX6ULL_SBMR_UART_H    #define KSA_IMX6ULL_SBMR_UART_H        #include <stdint.h>    #include <termios.h>        #define IMX6ULL_SRC_SBMR1_ADDR  0x020D8004UL    #define IMX6ULL_SRC_SBMR2_ADDR  0x020D801CUL        #define SBMR2_BMOD_SHIFT        24U    #define SBMR2_BMOD_MASK         (0x3U << SBMR2_BMOD_SHIFT)    #define BMOD_FUSES              0x0U  #define BMOD_SERIAL_DOWNLOADER  0x1U    #define BMOD_INTERNAL_BOOT      0x2U        #define SBMR1_CFG1_DEV_SHIFT    4U    #define SBMR1_CFG1_DEV_MASK     (0xFU << SBMR1_CFG1_DEV_SHIFT)        static inline void uart_cfg_raw_115200_3wire(struct termios *tio)    {    	cfsetispeed(tio, B115200);    	cfsetospeed(tio, B115200);    	tio->c_cflag |= (tcflag_t)(CLOCAL | CREAD | CS8);    	tio->c_cflag &= ~(tcflag_t)(PARENB | CSTOPB | CSIZE);    	tio->c_cflag |= (tcflag_t)CS8;    #ifdef CRTSCTS  	tio->c_cflag &= ~(tcflag_t)CRTSCTS;    #endif    	tio->c_iflag &= ~(tcflag_t)(IXON | IXOFF | IXANY);    }        #endif /* KSA_IMX6ULL_SBMR_UART_H */
  1. BMOD[1:0] at SRC_SBMR2[25:24] distinguishes USB OTG1 SDP (01) from Internal Boot (10).
  2. Explicitly clears both CRTSCTS and IXON/IXOFF so floating CTS# or 0x13 bytes never freeze TX.
picocom(1) / termios(3)(1) at a glance — GL-E00
picocom(1) / termios(3)(1)  GL-E00 Quick Reference  picocom(1) / termios(3)(1) SYNOPSIS       picocom -b 115200 -d 8 -p n -y n --flow n /dev/ttyUSB0 minicom -D       /dev/ttyUSB0 -b 115200 # Ctrl-A Z -> O -> Serial port setup -> F       (Hardware Flow: No!) KEY DIAGNOSTICS       RX prints, TX dead Hardware Flow Control (CRTSCTS) is ON over a 3-wire       cable, or Ctrl-S (XOFF) paused TX. Garbled characters Baud rate       mismatch (e.g., 9600 vs 115200) or missing common GND reference wire.       Zero output at POR BOOT_MODE=01 (waiting silently on USB SDP!), blank       flash, or TX/RX crossed backwards. Exit picocom Press Ctrl-A followed       by Ctrl-X. Kernel Systems Academy          Lesson 5.1          picocom(1) / termios(3)(1) GL-E00 quick reference · full manual page: man 1 picocom(1) / termios(3) 

Calculating 8N1 Timing Margins and Decoding SRC Strap Registers in C11

In verify.c, we compute exact 115200 8N1 bit and frame durations in integer nanoseconds, verify the 16x oversampling Stop-bit drift limit (~4.69%), model the 3-wire CRTSCTS TX-deadlock state table, and decode real SRC_SBMR1/SRC_SBMR2 register snapshots for SD, eMMC, NAND, and USB_OTG1 SDP.

Running this model on our host proves exact bitmask extraction and termios flag invariants before probing 0x020D8004 and 0x020D801C from the U-Boot prompt.

learner@ksa: ~/gl-e00/m05-l01
learner@ksa:~/gl-e00/m05-l01$ bat -H 29 -H 39 verify.c File: verify.c    #define _POSIX_C_SOURCE 200809L    #include <stdbool.h>    #include <stdint.h>    #include <stdio.h>        static const char *decode_imx_boot(uint32_t sbmr1, uint32_t sbmr2)    {    	uint32_t bmod = (sbmr2 >> 24U) & 0x3U;    	uint32_t cfg1_hi = (sbmr1 >> 4U) & 0xFU;    	uint32_t port = (sbmr1 >> 11U) & 0x1U;        	if (bmod == 0x1U)    		return "USB_OTG1_SDP";    	if (bmod == 0x0U)    		return "FUSE_BOOT";    	if (bmod != 0x2U)    		return "RESERVED";    	if ((cfg1_hi & 0x8U) != 0U)    		return "GPMI_RAW_NAND";    	if ((cfg1_hi == 0x4U || cfg1_hi == 0x5U) && port == 0U)    		return "USDHC1_SD";    	if ((cfg1_hi == 0x6U || cfg1_hi == 0x7U) && port == 1U)    		return "USDHC2_EMMC";    	return "OTHER_INTERNAL";    }        int main(void)    {  	uint64_t baud = 115200ULL;    	uint64_t bit_ps = 1000000000000ULL / baud; /* picoseconds per bit */    	uint64_t frame_ps = bit_ps * 10ULL;         /* 1 start + 8 data + 1 stop */    	uint64_t max_bytes_sec = baud / 10ULL;    	bool three_wire_cts_asserted = false;    	bool crtscts_on = true;    	bool tx_blocked = crtscts_on && !three_wire_cts_asserted;        	const char *sd = decode_imx_boot(0x00000040U, 0x02000000U);    	const char *emmc = decode_imx_boot(0x00000860U, 0x02000000U);  	const char *nand = decode_imx_boot(0x00000080U, 0x02000000U);    	const char *sdp = decode_imx_boot(0x00000860U, 0x01000000U);        	if (max_bytes_sec != 11520ULL || !tx_blocked)    		return 1;        	printf("UART_8N1 bit_us=%.2f frame_us=%.2f max_Bps=%llu 3wire_crtscts_tx_blocked=%d\n",    	       (double)bit_ps / 1e6, (double)frame_ps / 1e6,    	       (unsigned long long)max_bytes_sec, tx_blocked ? 1 : 0);    	printf("STRAPS sd=%s emmc=%s nand=%s recovery=%s\n", sd, emmc, nand, sdp);    	return 0;    }
  1. 10 bits per byte at 115200 baud yields 8.68 us/bit, 86.81 us/frame, and 11,520 B/s ceiling.
  2. Notice sdp overrides the identical SBMR1=0x860 eMMC straps when SBMR2 BMOD[1:0] is 01!

Validating Bit Timing and Strap Override Precedence

Look closely at the fourth decode_imx_boot() call in STRAPS: even when SRC_SBMR1 still holds 0x00000860 (USDHC2 eMMC DIP switches untouched!), setting BOOT_MODE[1:0] = 01 (sbmr2 = 0x01000000) routes execution straight to USB_OTG1_SDP! That is why factory recovery needs only a single BOOT_MODE toggle without disturbing your BOOT_CFG storage switch bank.

UART_8N1 also confirms why dumping 1 MiB of hex over 115200 UART takes over 90 seconds (11,520 B/s raw byte cap, and 3x longer in ASCII hex), motivating TFTP/USB for bulk image transfer.

learner@ksa: ~/gl-e00/m05-l01
learner@ksa:~/gl-e00/m05-l01gcc -std=c11 -Wall -Wextra -Werror verify.c -o verifylearner@ksa:~/gl-e00/m05-l01./verifyUART_8N1 bit_us=8.68 frame_us=86.81 max_Bps=11520 3wire_crtscts_tx_blocked=1STRAPS sd=USDHC1_SD emmc=USDHC2_EMMC nand=GPMI_RAW_NAND recovery=USB_OTG1_SDPlearner@ksa:~/gl-e00/m05-l01
strace — learner@ksa: ~/gl-e00/m05-l01
learner@ksa:~/gl-e00/m05-l01strace -e trace=write,exit_group ./verifywrite(1, "UART_8N1 bit_us=8.68 frame_us=86"..., 155) = 155exit_group(0)                           = ?+++ exited with 0 +++

Boot-Strap Contention and Serial Console Failure Modes

Whenever a newly powered board shows a completely blank 115200 8N1 terminal, check four physical facts in 30 seconds before touching source code: (1) BOOT_MODE isn't left in 01 (USB SDP prints zero UART characters while waiting silently on USB_OTG1!), (2) GND is shared and TX/RX aren't swapped, (3) BOOT_CFG matches the populated flash chip, and (4) POR_B was pulsed after setting the DIP switches.

If RX prints normally while TX ignores keystrokes, clear CRTSCTS and IXON first.

Silent Blank UART Because BOOT_MODE Left in 01 After UUU Flashing:

  • Symptom: Flashing U-Boot to eMMC via UUU succeeds 100%, yet pressing the reset button produces zero characters on UART1.
  • Root Cause: With BOOT_MODE[1:0] still set to 01 (Serial Downloader), the i.MX6ULL Boot ROM never reads eMMC and outputs nothing on UART1 — it silently enumerates USB_OTG1 waiting for another SDP host command.
  • Fix: Switch BOOT_MODE[1:0] back to 10 (Internal Boot), verify BOOT_CFG selects eMMC/NAND/SD, and trigger a full POR_B power-on reset.

RGB LCD Ribbon Cable Pulling LCD_DATA Boot Straps High at POR_B:

  • Symptom: Board boots reliably from SD card when bare, then stops booting completely the instant an external RGB LCD panel or peripheral hat is plugged into the LCD_DATA header.
  • Root Cause: The i.MX6ULL multiplexes BOOT_CFG1/2/4 onto LCD_DATA00..23 during POR_B; external pull-ups or powered back-feeding on the LCD cable override weak 10 kOhm board strap resistors and select a non-existent boot device.
  • Fix: Isolate LCD_DATA peripheral loads until POR_B deasserts, strengthen strap resistors per hardware design guidelines, or burn BT_FUSE_SEL + boot fuses for production boards.

Guided Practice

Extend verify.c to compute receiver sampling drift at bit 9.5 (middle of the Stop bit, 9.5 bit periods after the falling Start edge): if the target UART baud clock runs at 118,500 Hz (+2.86% fast) while the host runs at 112,500 Hz (-2.34% slow), does cumulative phase error exceed 0.5 bit periods (4.34 us)?

Print the cumulative drift in microseconds and verify that 5.20% > 4.76% (0.5 / 10.5) triggers a Stop-bit framing error (FE), explaining why garbage characters often appear at the tail of 0xFF/0x55 bytes when baud dividers are misconfigured.

Independent Practice

Write a C11 helper check_termios_3wire_safe(uint32_t c_cflag, uint32_t c_iflag) using <termios.h> constants that verifies CS8 is set, PARENB and CSTOPB are clear, CRTSCTS (when defined) is clear, and IXON | IXOFF are clear.

Test it on a cfmakeraw(&tio) struct before and after masking CRTSCTS to verify whether cfmakeraw alone clears hardware flow control on Linux glibc (spoiler: cfmakeraw does not touch CRTSCTS!).

Verification Checks

quiz · 1 of 3

During bring-up over a 3-wire (TX, RX, GND) USB-TTL adapter, U-Boot prints its boot banner cleanly, yet pressing keys on your laptop never interrupts autoboot. What is the first host setting to check?

quiz · 2 of 3

How long does a single byte take on the wire at 115200 8N1, and what is the maximum continuous byte rate?

quiz · 3 of 3

You flip the i.MX6ULL BOOT_MODE[1:0] DIP switch from 10 to 01 while the board is running Linux, then run reboot from the shell. Why does the board boot eMMC again instead of entering USB SDP?

Key takeaways

  • At 115200 8N1, each asynchronous frame carries 10 bit cells (1 Start, 8 LSB-first data, 0 parity, 1 Stop) at 8.68 us/bit (86.81 us/frame, 11,520 bytes/s max).
  • Leaving hardware flow control (CRTSCTS) enabled in minicom or picocom on a 3-wire (TX/RX/GND) USB-TTL bridge blocks host keyboard TX waiting on unasserted CTS# while target RX prints normally.
  • At POR_B reset release, the i.MX6ULL Boot ROM samples BOOT_MODE[1:0] (SRC_SBMR2[25:24]): 10 selects Internal Boot via BOOT_CFG straps, 01 enters USB_OTG1 Serial Downloader (SDP), and 00 boots from eFUSEs.
  • Under Internal Boot (BOOT_MODE = 10), BOOT_CFG1[7:4] (SRC_SBMR1[7:4] sampled from LCD_DATA pins) selects SD (USDHC1), eMMC (USDHC2), or raw NAND (GPMI).
Progress is saved on this device.

search — fzf

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

keyboard shortcuts — less

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

figure