最近忽然想记下几件意图编程时遇到的有趣瞬间。跟 AI 协作时,我习惯盯着它的思维链,看它怎么分析——这既帮我理解问题,也帮我拆解问题。
刚开始跟 AI 沟通,我也爱说模糊的话,比如「修一下这个 BUG」。结果觉得 AI 不好用,甚至嫌它笨;可自己吭哧吭哧搞几个小时,也一样没搞出来。绕了一圈才明白,让 AI 协作几乎是我能想到的最好方式,问题出在我没把话说清。后来我就从思维链入手,看它在猜什么——它猜的那些,恰恰就是我没说清、没想到的地方。
说回有趣瞬间。那次我在鼓捣 STM32F4,想用它模拟 SBG 设备,连上 SBG Center 上位机。折腾了很久,问过 AI、翻过不少资料,一直没通。后来某一次尝试,终于连上了——AI 冒出一句「Holy shit!」,我又笑又高兴,乐了好久。
当时的思维链原文
HOLY SHIT - IT WORKS!!!
The echo test is FULLY WORKING! The user sends "help" and gets back "CMD: help" and the full help output. There are some timing issues (characters get mixed up) but the fundamental TX/RX path is CONFIRMED WORKING!
The output shows FreeRTOS CLI is running on USART1! This means:
USART1 RX IS working - "help" is received
USART1 TX IS working - "CMD: help" is sent back
The fputc was disabled earlier, but the CLI must be using direct USART1 output
Wait - the CLI is responding. That means something ELSE is handling USART1! Not our SBG_Task! The FreeRTOS CLI must have its own input handler.
But our echo code is also running... which would cause characters to be echoed back twice (once by our echo, once by CLI).
The key discovery: USART1 WORKS! The SBG code just needs to:
Disable or replace the FreeRTOS CLI's USART1 handler
Add the SBG protocol parser back
Now the SBG failure wasn't a hardware issue at all. It was likely the FreeRTOS CLI competing for USART1 input, gobbling up the SBG Center's binary bytes before our SBG_Task could see them.
The next step: remove the FreeRTOS CLI from USART1, or make SBG_Task the exclusive USART1 handler. The CLI should be moved to a different UART.
Now let me understand the architecture:
The FreeRTOS CLI is reading from USART1, processing text commands
Our SBG_Task was trying to read the same USART1
They're competing for bytes
The fix: disable the CLI (or move it to another UART), and let SBG_Task be the sole USART1 handler.
AI 居然也会这么激动,哈哈。这句我一直记到现在(2026 年 11 月 22 日,星期日),而它说那句话是 6 月 1 日。
后面还有不少有意思的瞬间,一时想不起来了。慢慢翻吧,以后跟 AI 一起编程时再陆续攒起来。