$npx -y skills add easyzoom/aix-skills --skill embedded-serial-log-debugUse when collecting or debugging embedded serial UART logs, boot consoles,乱码, missing output, baud-rate issues, or serial terminal access
| 1 | # Embedded Serial Log Debug |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Use this skill to make serial logs trustworthy before drawing conclusions from them. Confirm wiring, voltage level, port ownership, baud settings, boot timing, and log source before debugging firmware behavior. |
| 6 | |
| 7 | ## When To Use |
| 8 | |
| 9 | Use this skill when: |
| 10 | |
| 11 | - The user needs UART boot logs, serial console access, or firmware printf output. |
| 12 | - Serial output is missing, garbled, intermittent, delayed, duplicated, or stops mid-boot. |
| 13 | - The task involves USB-to-UART adapters, `screen`, `picocom`, `minicom`, logic analyzers, boot logs, or console prompts. |
| 14 | |
| 15 | Do not use this skill when the problem is already proven to be a higher-level protocol issue unrelated to raw serial capture. |
| 16 | |
| 17 | ## First Questions |
| 18 | |
| 19 | Ask for: |
| 20 | |
| 21 | - Board/chip and which UART pins are used. |
| 22 | - USB-to-UART adapter model and voltage level. |
| 23 | - Serial device path, such as `/dev/ttyUSB0` or `/dev/ttyACM0`. |
| 24 | - Baud rate, data bits, parity, stop bits, and flow control if known. |
| 25 | - Whether logs are expected from boot ROM, bootloader, kernel, RTOS, or application. |
| 26 | - Whether TX/RX/GND are accessible and common ground is connected. |
| 27 | |
| 28 | ## Workflow |
| 29 | |
| 30 | 1. Confirm electrical compatibility. |
| 31 | Check voltage level, common ground, TX/RX crossing, and whether pins are shared with boot/download modes. |
| 32 | |
| 33 | 1. Confirm terminal ownership. |
| 34 | Ensure no other terminal, programmer, modem manager, or IDE owns the serial port. |
| 35 | |
| 36 | 1. Start with common settings. |
| 37 | Use 115200 8N1 no flow control unless the board documentation says otherwise. |
| 38 | |
| 39 | 1. Capture from reset. |
| 40 | Open the terminal before reset or power-on so early boot logs are not missed. |
| 41 | |
| 42 | 1. Classify the symptom. |
| 43 | Missing output,乱码, only TX visible, only RX visible, stops after bootloader, login prompt only, or application printf missing. |
| 44 | |
| 45 | 1. Verify with a second observation method. |
| 46 | Use a logic analyzer, oscilloscope, known-good adapter, or loopback test when serial output is suspect. |
| 47 | |
| 48 | ## Command Patterns |
| 49 | |
| 50 | ```bash |
| 51 | picocom -b 115200 /dev/ttyUSB0 |
| 52 | screen /dev/ttyUSB0 115200 |
| 53 | minicom -D /dev/ttyUSB0 -b 115200 |
| 54 | stty -F /dev/ttyUSB0 115200 cs8 -cstopb -parenb -ixon -ixoff |
| 55 | ``` |
| 56 | |
| 57 | For permissions: |
| 58 | |
| 59 | ```bash |
| 60 | ls -l /dev/ttyUSB0 |
| 61 | groups |
| 62 | ``` |
| 63 | |
| 64 | Do not run permission-changing commands unless the user approves them. |
| 65 | |
| 66 | ## Symptom Guide |
| 67 | |
| 68 | | Symptom | Likely checks | |
| 69 | | --- | --- | |
| 70 | | No output | TX pin, ground, voltage, wrong UART, reset timing, firmware not booting | |
| 71 | | Garbled output | Baud, clock source, 1T/12T mode, parity, wrong oscillator | |
| 72 | | Stops after bootloader | App jump, app UART init, logging level, crash after handoff | |
| 73 | | Only input fails | RX wiring, console disabled, flow control, login shell not running | |
| 74 | | Random characters on reset | Floating line, wrong voltage, boot ROM at different baud | |
| 75 | |
| 76 | ## Verification |
| 77 | |
| 78 | Before trusting serial evidence: |
| 79 | |
| 80 | - State adapter, serial path, voltage level, wiring assumptions, and terminal settings. |
| 81 | - Confirm capture starts before reset/power-on when boot logs matter. |
| 82 | - Report whether the output is clean, garbled, absent, or partial. |
| 83 | - If logs are absent, state which lower-layer checks passed and which remain unverified. |
| 84 | |
| 85 | ## Common Failures |
| 86 | |
| 87 | - Debugging firmware before confirming the adapter voltage and common ground. |
| 88 | - Opening the terminal after early boot logs already passed. |
| 89 | - Assuming 115200 when the boot ROM or app uses another baud. |
| 90 | - Leaving hardware flow control enabled accidentally. |
| 91 | - Forgetting that programmer tools may also occupy the serial port. |
| 92 | |
| 93 | ## Example |
| 94 | |
| 95 | User: |
| 96 | |
| 97 | ```text |
| 98 | 串口没日志,板子不知道有没有跑起来。 |
| 99 | ``` |
| 100 | |
| 101 | Agent: |
| 102 | |
| 103 | 1. Asks for board, UART pins, adapter voltage, serial path, baud, and expected log source. |
| 104 | 1. Opens capture before reset. |
| 105 | 1. If no output, checks wiring and uses GPIO heartbeat or logic analyzer before blaming firmware. |