From 06fb009773416a7fbd5f996091ce54c5ac58a36e Mon Sep 17 00:00:00 2001 From: wangfq Date: Wed, 12 Aug 2026 19:15:37 +0800 Subject: [PATCH] =?UTF-8?q?test(vd960DBN):=20UART2=20=E9=9A=94=E7=A6=BB?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=20=E2=80=94=20=E8=BD=AF=E4=BB=B6=E7=A6=81?= =?UTF-8?q?=E7=94=A8=20Loop=20=E5=8F=A3=E5=AE=9A=E4=BD=8D=E5=A4=8D?= =?UTF-8?q?=E4=BD=8D=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 现场: RST_REASON 全 0 瞬态复位, 总在 Loop 帧后 ~10ms, 指向 Loop 侧干扰 实验: uart_init 后立即禁用 USART2 + PA3 脱离 UART 功能(上拉输入) = 等效软件断开 Loop; 同时快照无帧入队, 同步验证 SPI 活动非诱因 判定: 不复位+无乱码 → Loop 数据路径干扰实锤 还复位 → 物理引脚级干扰 或 CH32 自身电源问题 通过后删除此块 --- .../APP/peripheral_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c index ceecfa1..1d8858c 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c @@ -331,6 +331,23 @@ int main(void) HAL_Init(); uart_init(); + + /* ===== 实验: 禁用 UART2 (Loop 口) 隔离测试 (2026-08-12) ===== + 目的: 验证 Loop MCU 数据/干扰是否导致复位循环 (RST_REASON 全 0 瞬态复位) + 做法: USART2 关断 + PA3 脱离 UART 功能(上拉输入) — 等效软件断开 Loop + 通过后删除此块; 另: 禁用后快照无帧入队, 同步验证快照 SPI 活动非诱因 */ + { + GPIO_InitTypeDef gpio; + USART_ITConfig(USART2, USART_IT_RXNE, DISABLE); + USART_Cmd(USART2, DISABLE); + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); + gpio.GPIO_Pin = GPIO_Pin_3; + gpio.GPIO_Mode = GPIO_Mode_IPU; /* PA3 脱离 UART2, 上拉输入 */ + gpio.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIOA, &gpio); + PRINT("ISOLATE: UART2 disabled (Loop isolation test)\n"); + } + TIM3_Init(); TIM2_Init();