Pad Electrical Fields: Pulls, Drive, Slew, and Open-Drain
Look inside an i.MX6ULL CMOS I/O pad cell to understand Schmitt hysteresis (HYS), hierarchical pull versus bus-keeper bias (PKE, PUE, PUS), open-drain release (ODE), and segmented drive impedance (DSE/SRE)—replacing copy-pasted hex magic like 0x10B0 with verified electrical engineering.
What you'll learn
- Decode HYS, PUS, PUE, PKE, ODE, SPEED, DSE, and SRE fields.
- Diagnose why selecting PUS alone does not necessarily enable a pull resistor.
- Choose a conservative pad policy and state which electrical claims still require measurement.
Inside an i.MX6ULL CMOS Pad Cell: Transistors, Bias, and Hysteresis
Open almost any vendor file and you will spot magic constants like *pad_ctl = 0x10B0; with a misleading comment claiming *"100K pull-down LED config."* If you copy 0x10B0 onto an external button input expecting a 100 kOhm pull-down resistor, pressing the button once latches the pin forever—because 0x10B0 does NOT enable a pull-down resistor at all! Why? Stop memorizing hex literals and trace the three analog/CMOS subcircuits inside a physical i.MX6ULL pad cell in Figure 3.2a (IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03 at 0x020E02F4):
- Schmitt-Trigger Input Receiver (
HYS, bit16): A plain CMOS inverter switches around a single threshold (~V_DD / 2). When a slow RC sensor edge crawls across1.65 Vcarrying40 mVof power-rail noise, a single-threshold receiver fires a burst of false0->1->0->1digital glitches! EnablingHYS = 1(hysteresis) activates positive feedback inside the receiver, splitting the rising threshold (V_IH) above the falling threshold (V_IL) so small noise ripples inside the deadband are ignored. Crucial limit:HYSrejects millivolt analog noise on an edge—it is not a time-based debouncer and cannot absorb5..15 msmechanical switch contact bounce! - Hierarchical Bias Network (
PKEbit12->PUEbit13->PUSbits[15:14]): Why three separate fields? Because silicon offers two fundamentally different weak bias circuits behind one master power switchPKE(Pull/Keeper Enable, bit12):
- If
PKE == 0, the entire bias block is disconnected (Hi-Zfloating input). - If
PKE == 1andPUE == 0(Pull/Keeper Select = Keeper), silicon connects a weak cross-coupled inverter latch (bus keeper) that gently holds whichever logic0or1was last driven on the wire—andPUS[15:14]is completely ignored! That proves why0x10B0(bit 12 = 1,bit 13 = 0) is a bus keeper, never a100 kOhmpull-down! - Only when
PKE == 1ANDPUE == 1does silicon connect the resistivePUS[15:14]network:00=100 kOhmpull-down,01=47 kOhmpull-up,10=100 kOhmpull-up,11=22 kOhmpull-up.
- Output Driver Stage (
ODEbit11,SPEED[7:6],DSE[5:3],SRE[0]): Normal push-pull mode (ODE = 0) drives bothPMOS(high) andNMOS(low). SettingODE = 1(Open-Drain Enable) disables the high-sidePMOStransistor: writing0actively sinks toGND, whereas writing1releases the wire (Hi-Z) so an external pull-up resistor (2.2 kOhm..4.7 kOhmonI2C) pulls the bus high attau = R_pull * C_bus! Meanwhile,DSE[5:3](Drive Strength) switches1..7parallel transistor fingers in (R0/1~260 ohmdown toR0/6~43 ohm,R0/7~37 ohm)—whereasDSE == 0disconnects ALL output fingers (Hi-Z), killing output drive even whenGPIO_GDIR == 1!SRE[0](Slew Rate) selects slow (0, lower EMI/ringing) vs fast (1, sharp high-frequency edges).
Figure 3.2a. Inside an i.MX6ULL CMOS pad cell — output DSE slices and ODE open-drain release (left), PKE -> PUE -> PUS keeper vs pull hierarchy (center), and HYS Schmitt receiver (right).
mental model: If SW_MUX_CTL routes which peripheral track reaches the station, SW_PAD_CTL configures the electrical overhead wire (PKE/PUE/PUS), regenerative holding brake (Keeper), locomotive traction motors (DSE), and throttle ramp (SRE).
Where it stops working: Unlike rail switches, setting pull-strength bits (PUS) has zero physical effect when the mode switch (PUE) selects bus-keeper mode or the master breaker (PKE) is open, and actual signal rise times depend on external trace capacitance and pull-up resistors.
definition ( SW_PAD_CTL Electrical Policy Bitfields): In standard i.MX6ULL IOMUXC_SW_PAD_CTL_PAD_* registers (0x020E02F4 for GPIO1_IO03, active field mask 0x0001F8F9U), HYS[16] enables Schmitt input hysteresis; PKE[12] powers the bias cell; PUE[13] selects resistive pull (1) over bus keeper (0); PUS[15:14] selects 100K down (0), 47K up (1), 100K up (2), or 22K up (3) only when PKE=1 and PUE=1; ODE[11] enables open-drain output; and SPEED[7:6], DSE[5:3] (0=Hi-Z, 1..7 = R0/1..R0/7), and SRE[0] govern output impedance and edge slew.
Step through the four-stage electrical design checklist below:
- Step 1. Step 1 (Input Path): Enable HYS[16] = 1 for Schmitt noise immunity on slow digital edges (still debounce switches in software!).
- Step 2. Step 2 (Bias Network): Check PKE[12] = 1 and PUE[13] = 1 before trusting PUS[15:14]; PUE = 0 selects bus keeper.
- Step 3. Step 3 (Output Path): Set ODE[11] = 1 for open-drain release and choose non-zero DSE[5:3] (DSE = 0 disables the output driver!).
- Step 4. Step 4 (Measurement): Preserve reserved gaps (~0x0001F8F9U) and verify rise time tau = R * C and rail levels on an oscilloscope.
Figure 3.2b. Decode PKE -> PUE -> PUS and DSE != 0 explicitly instead of copying opaque hex constants.
Decoding 32-Bit SW_PAD_CTL Words and Preserving Reserved Gaps
Inspect Figure 3.2b to compare the exact 32-bit bitfield layout (0x0001F8F9U active mask, leaving [31:17], [10:8], and [2:1] untouched) across three real board roles:
0x000010B0(Push-Pull LED Output):PKE=1, PUE=0(Keeper),SPEED=2(100 MHz),DSE=6(R0/6),SRE=0(slow edge—no needless RF ringing for a1 HzLED!).0x0001B000(Pulled-Up Digital Input,pad_policy.cbelow):(1U << 16) | (2U << 14) | (1U << 13) | (1U << 12)enablesHYS=1,PUS=2(100 kOhmpull-up),PUE=1(pull mode!), andPKE=1, withDSE=0.0x0001B8B0(Open-DrainI2CBus): AddsODE=1(bit 11) +DSE=6+SPEED=2(and pairs withSION=1inSW_MUX_CTLplus an external2.2 kOhmpull-up because internal~100 kOhm * 100 pFtakes~22 usto rise, violating400 kHzI2C's300 nsrise-time spec!).
Figure 3.2b. Exact 32-bit SW_PAD_CTL bitfields under mask 0x0001F8F9 (top) and three verified electrical profiles (bottom).
learner@ksa:~/gl-e01/m03-l02$ bat pad_policy.c File: pad_policy.c #include <stdint.h> static volatile uint32_t *const pad_gpio1_io03 = (volatile uint32_t *)(uintptr_t)0x020e02f4U; void configure_input_pullup(void) { const uint32_t mask = 0x0001f8f9U; const uint32_t policy = (1U << 16) | (2U << 14) | (1U << 13) | (1U << 12); uint32_t old = *pad_gpio1_io03; *pad_gpio1_io03 = (old & ~mask) | (policy & mask); }Encoding and Auditing Hierarchical Pad Policies in C11
iomuxc_pad_ctl_builder.c encodes all eight fields with range checks (pus <= 3, speed <= 3, dse <= 7), implements decode_bias() following the hardware PKE -> PUE gate hierarchy (proving 1U << 13 alone is BIAS_DISABLED while 0x10B0U is BIAS_KEEPER), verifies 0x1B000U (BIAS_PULL) and 0x1B8B0U (od_i2c), and confirms apply_pad_masked() preserves every bit outside 0x0001F8F9U.
learner@ksa:~/gl-e01/m03-l02$ bat -H 9 -H 10 -H 11 -H 12 -H 13 -H 14 -H 15 -H 16 -H 17 -H 19 -H 20 -H 21 -H 22 -H 23 -H 24 -H 25 -H 26 -H 27 -H 28 -H 31 -H 32 -H 33 -H 34 -H 35 iomuxc_pad_ctl_builder.c File: iomuxc_pad_ctl_builder.c #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> enum bias_kind { BIAS_DISABLED = 0, BIAS_KEEPER = 1, BIAS_PULL = 2 }; struct pad_cfg { bool hys, pue, pke, ode, sre; unsigned pus, speed, dse; }; static bool build_pad_ctl(const struct pad_cfg *c, uint32_t *word_out) { if (c->pus > 3U || c->speed > 3U || c->dse > 7U) return false; *word_out = ((uint32_t)c->hys << 16) | (c->pus << 14) | ((uint32_t)c->pue << 13) | ((uint32_t)c->pke << 12) | ((uint32_t)c->ode << 11) | (c->speed << 6) | (c->dse << 3) | (uint32_t)c->sre; return true; } static enum bias_kind decode_bias(uint32_t r) { if ((r & (1U << 12)) == 0U) return BIAS_DISABLED; return (r & (1U << 13)) != 0U ? BIAS_PULL : BIAS_KEEPER; } static uint32_t apply_pad_masked(uint32_t old, uint32_t policy) { const uint32_t mask = UINT32_C(0x0001f8f9); return (old & ~mask) | (policy & mask); } int main(void) { assert(decode_bias(0U) == BIAS_DISABLED); assert(decode_bias(1U << 13) == BIAS_DISABLED); assert(decode_bias(0x10b0U) == BIAS_KEEPER); assert(((0x10b0U >> 3) & 7U) == 6U && ((0x10b0U >> 6) & 3U) == 2U); struct pad_cfg in_pullup = {true, true, true, false, false, 2U, 0U, 0U}; uint32_t pol = 0U; assert(build_pad_ctl(&in_pullup, &pol) && pol == 0x1b000U); assert(decode_bias(pol) == BIAS_PULL); struct pad_cfg bad_dse = {false, false, false, false, false, 0U, 0U, 8U}; assert(!build_pad_ctl(&bad_dse, &pol)); uint32_t old = 0xa5a5a5a5U, next = apply_pad_masked(old, pol); assert((next & ~UINT32_C(0x1f8f9)) == (old & ~UINT32_C(0x1f8f9))); struct pad_cfg od_i2c = {true, true, true, true, false, 2U, 2U, 6U}; uint32_t od_word = 0U; assert(build_pad_ctl(&od_i2c, &od_word) && od_word == 0x1b8b0U); printf("0x10B0=keeper(DSE=%u,SPD=%u) pullup=0x%05X od_i2c=0x%05X\n", (0x10b0U >> 3) & 7U, (0x10b0U >> 6) & 3U, pol, od_word); return 0; }- Validate multi-bit ranges (PUS <= 3, SPEED <= 3, DSE <= 7) before shifting into mask 0x0001F8F9U.
- Check PKE (bit 12) before PUE (bit 13): PUS [15:14] has zero pull effect whenever PKE == 0 or PUE == 0.
- Preserve reserved bit gaps [31:17], [10:8], and [2:1] when updating an existing SW_PAD_CTL register.
Running the Pad-Control Builder and Cross-Compiling Target Policy
Execute iomuxc_pad_ctl_builder on the workstation and cross-compile pad_policy.c for freestanding Cortex-A7. Remember that SW_PAD_CTL configures electrical behavior only—SW_MUX_CTL (m03-l01) must still route the desired peripheral function to the ball!
learner@ksa:~/gl-e01/m03-l02gcc -std=c11 -Wall -Wextra -Werror -pedantic iomuxc_pad_ctl_builder.c -o iomuxc_pad_ctl_builderlearner@ksa:~/gl-e01/m03-l02./iomuxc_pad_ctl_builder0x10B0=keeper(DSE=6,SPD=2) pullup=0x1B000 od_i2c=0x1B8B0learner@ksa:~/gl-e01/m03-l02clang --target=armv7a-none-eabi -mcpu=cortex-a7 -marm -mfloat-abi=soft -ffreestanding -std=c11 -Wall -Wextra -Werror -x c -c pad_policy.c -o target.olearner@ksa:~/gl-e01/m03-l02learner@ksa:~/gl-e01/m03-l02strace -e trace=write,exit_group \./iomuxc_pad_ctl_builderwrite(1, "0x10B0=keeper(DSE=6,SPD=2) pullu"..., 57) = 57exit_group(0) = ?+++ exited with 0 +++Pad Electrical Role Comparison Matrix
Match every board trace to the electrical profile its external circuit requires:
| Pad Role | Typical SW_PAD_CTL Word | Decoded Active Fields | Electrical Caveat |
|---|---|---|---|
Push-pull GPIO LED output | 0x000010B0 | PKE=1, PUE=0 (keeper), SPEED=2, DSE=6, SRE=0 | DSE=0 (Hi-Z) disables output driver completely even when GDIR=1! |
| tactile switch input | 0x0001B000 | HYS=1, PUS=2 (100K up), PUE=1, PKE=1, DSE=0 | HYS suppresses slow-edge threshold chatter, NOT 5..15 ms contact bounce |
Open-drain shared bus (I2C) | 0x0001B8B0 | HYS=1, PUS=2, PUE=1, PKE=1, ODE=1, DSE=6 | Requires SION=1 in MUX_CTL + external 2.2k..4.7k pull-up for 400 kHz |
High-speed SD/ENET clock/data | 0x000170F9 / B9 | HYS=1, 47K up, SPEED=2/3, DSE=6/7, SRE=1 | Fast slew (SRE=1) + strong DSE rings on unterminated long wires |
Later: Lesson m03-l03 completes the GPIO chain inside 0x0209C000—preload-safe DR/GDIR sequencing, PSR wire observation, ICR1/ICR2 edge configuration, and Write-One-to-Clear (W1C) ISR acknowledgment.
Common Production Pitfalls
warning: Symptom: A push-button pin configured with (2U << 14) | (1U << 12) (PUS = 100K_UP, PKE = 1, forgetting PUE = 1U << 13) reads 0 permanently after the very first button press to ground. Root Cause: With PUE == 0, the bias cell operates as a bus keeper that latches whichever logic level last appeared on the wire (0 after ground contact) instead of pulling back to 3.3 V. Fix: Set both PKE (bit 12) and PUE (bit 13) whenever PUS (bits 15:14) must act as a pull-up or pull-down resistor.
warning: Symptom: CCM_CCGR1, MUX_MODE = ALT5, GPIO1_GDIR = (1U << 3), and GPIO1_DR are all configured, yet the physical output pin stays completely high-impedance (0 mA drive). Root Cause: SW_PAD_CTL was left at 0x0001B000 (an input policy with DSE[5:3] == 0), disconnecting all seven output transistor fingers (Hi-Z). Fix: Program a non-zero DSE drive strength (such as DSE = 6, 6U << 3) on every push-pull or open-drain output pad.
Practice & Retrieval
Guided Practice: Decoding 0x000178B1 & Encoding Custom Output Pads
Step 1 (Decode): Decode 0x000178B1U field by field (HYS=1, PUS=1 47K pull-up, PUE=1, PKE=1, ODE=1 open-drain, SPEED=2 100 MHz, DSE=6 R0/6, SRE=1 fast slew). Step 2 (Hi-Z Output Check): State why ode = false, dse = 0U fails to drive an LED even when GPIO_GDIR bit 3 is 1 (DSE=0 tri-states the pad buffer). Step 3 (Encode): Compute the hex word for HYS=0, PKE=0, ODE=0, SPEED=1 (50 MHz), DSE=4 (R0/4), SRE=0 ((1U << 6) | (4U << 3) = 0x00000060U).
Independent Practice: Pad-Role Consistency Linter (pad_role_lint.c)
Write a standalone ISO C11 verifier pad_role_lint.c implementing int audit_pad_policy(uint32_t mux_ctl, uint32_t pad_ctl, bool is_output, bool is_od_bus). Flag: (1) is_output && DSE == 0; (2) PUS != 0 && (!PKE || !PUE) (dead pull bits); (3) is_od_bus && (!ODE || !(mux_ctl & 0x10U)); and (4) any set bit outside 0x0001F8F9U. Test 3 valid profiles and 4 defective ones.
Key takeaways
- Standard
i.MX6ULLSW_PAD_CTLwords packHYS[16],PUS[15:14],PUE[13],PKE[12],ODE[11],SPEED[7:6],DSE[5:3], andSRE[0]inside mask0x0001F8F9U. PKE(bit 12) powers the bias block, andPUE(bit 13) chooses resistive pull (1, usingPUS) versus bus keeper (0, ignoringPUS).ODE(bit 11 = 1) releases high-sidePMOSdrive on logical1;DSE[5:3]sets output impedance (R0/1..R0/7, with0 = Hi-Zdisabled!).0x000010B0enables bus keeper (PKE=1, PUE=0) withDSE=6andSPEED=2—not an active100 kOhmpull-down.- For the general pad-control example, HYS is bit 16, PUS is bits 15:14, PUE is bit 13, and PKE is bit 12.
- PKE enables the pull/keeper function, while PUE selects pull operation rather than keeper operation.
- No; the mux route remains a separate configuration choice.