$npx -y skills add easyzoom/aix-skills --skill embedded-peripheral-bringupUse when bringing up embedded GPIO, UART, SPI, I2C, PWM, ADC, timers, DMA, interrupts, or board-level peripheral functionality
| 1 | # Embedded Peripheral Bring-Up |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Use this skill to bring up peripherals from the outside in: board wiring, pin mux, clocks, reset state, electrical mode, driver configuration, interrupts/DMA, and observable signals. Avoid rewriting drivers before proving the peripheral can physically signal. |
| 6 | |
| 7 | ## When To Use |
| 8 | |
| 9 | Use this skill when: |
| 10 | |
| 11 | - GPIO, UART, SPI, I2C, PWM, ADC, timer, DMA, or interrupt behavior is wrong. |
| 12 | - A peripheral has no signal, wrong timing, stuck bus, bad data, or only works sometimes. |
| 13 | - The user has schematic snippets, pin mappings, logic analyzer traces, oscilloscope captures, or register dumps. |
| 14 | |
| 15 | Do not use this skill when the chip is not booting or the firmware cannot be flashed; resolve those first. |
| 16 | |
| 17 | ## First Questions |
| 18 | |
| 19 | Ask for: |
| 20 | |
| 21 | - MCU/SoC and board. |
| 22 | - Peripheral and exact pins. |
| 23 | - Expected behavior versus observed behavior. |
| 24 | - Clock frequency and driver/framework. |
| 25 | - Schematic/pinout evidence and whether signals were measured. |
| 26 | - Whether interrupts, DMA, or low-power modes are involved. |
| 27 | |
| 28 | ## Workflow |
| 29 | |
| 30 | 1. Prove the board path. |
| 31 | Confirm the signal pin, package pin, board net, connector, level shifter, pull-up/down, and external device. |
| 32 | |
| 33 | 1. Prove pin configuration. |
| 34 | Check mux/alternate function, electrical mode, drive strength, pull, analog/digital mode, and open-drain requirements. |
| 35 | |
| 36 | 1. Prove clock and reset. |
| 37 | Confirm peripheral bus clock, module reset release, prescaler, and any power domain enable. |
| 38 | |
| 39 | 1. Start with the simplest observable action. |
| 40 | Toggle GPIO, emit one UART byte, generate one SPI clock burst, scan I2C address, or start one timer output. |
| 41 | |
| 42 | 1. Add interrupts and DMA last. |
| 43 | First prove polling or simple blocking transfers, then enable IRQ/DMA and verify vector, priority, buffer alignment, and cache. |
| 44 | |
| 45 | 1. Compare measurements to configuration. |
| 46 | Use logic analyzer or oscilloscope evidence for timing, polarity, phase, voltage, and bus contention. |
| 47 | |
| 48 | ## Peripheral Checks |
| 49 | |
| 50 | ### GPIO |
| 51 | |
| 52 | - Pin mux selects GPIO, not alternate function. |
| 53 | - Output mode and drive strength match load. |
| 54 | - Input mode, pull-up/down, and voltage threshold match circuit. |
| 55 | - Board net is not held by another device. |
| 56 | |
| 57 | ### UART |
| 58 | |
| 59 | - TX/RX crossed correctly. |
| 60 | - Baud calculation matches clock source. |
| 61 | - Pins use correct alternate function. |
| 62 | - Flow control disabled unless wired. |
| 63 | - Logic level matches adapter or peer device. |
| 64 | |
| 65 | ### SPI |
| 66 | |
| 67 | - CPOL/CPHA, bit order, word size, and chip select behavior match the slave. |
| 68 | - SCK frequency is within slave limits. |
| 69 | - MISO/MOSI not swapped. |
| 70 | - CS timing and idle state are correct. |
| 71 | |
| 72 | ### I2C |
| 73 | |
| 74 | - Pull-ups exist and voltage is correct. |
| 75 | - Address is 7-bit versus 8-bit as expected. |
| 76 | - Bus is not stuck low. |
| 77 | - Speed mode matches devices and wiring. |
| 78 | - ACK/NACK is checked before debugging payloads. |
| 79 | |
| 80 | ### ADC/PWM/Timers |
| 81 | |
| 82 | - Pin analog mode or alternate function is correct. |
| 83 | - Reference voltage, sample time, prescaler, period, polarity, and timer clock are verified. |
| 84 | - Timer reload and compare values match actual clock. |
| 85 | |
| 86 | ## Verification |
| 87 | |
| 88 | Before claiming bring-up progress: |
| 89 | |
| 90 | - State measured signal evidence or explain why measurement is unavailable. |
| 91 | - Confirm pin, mux, clock, reset, and electrical mode. |
| 92 | - Confirm expected versus observed timing or voltage. |
| 93 | - If IRQ/DMA is involved, confirm the simpler polling path works or state why it cannot be tested. |
| 94 | |
| 95 | ## Common Failures |
| 96 | |
| 97 | - Debugging driver code before checking pin mux and peripheral clock. |
| 98 | - Trusting schematic labels without checking package pin and board net. |
| 99 | - Enabling DMA before proving basic transfers. |
| 100 | - Ignoring pull-ups on I2C or open-drain outputs. |
| 101 | - Confusing logical UART names with physical pins on the board. |
| 102 | |
| 103 | ## Example |
| 104 | |
| 105 | User: |
| 106 | |
| 107 | ```text |
| 108 | I2C 读不到传感器。 |
| 109 | ``` |
| 110 | |
| 111 | Agent: |
| 112 | |
| 113 | 1. Asks for MCU, pins, pull-ups, address, speed, driver, and logic analyzer result. |
| 114 | 1. Checks clock, mux, open-drain mode, and bus idle levels. |
| 115 | 1. Confirms ACK during address phase before debugging register reads. |