debug(rf): revert to polling EV1527_Decode, ISR does pure edge counting

Diagnostic experiment: restore the commit d8df5d4 polling decode
algorithm/thresholds unchanged, while P3.6 ISR now only increments an
edge counter (no decode state machine). Successful decodes print the
edge-count delta over the decode window to compare against the
EV1527 theoretical 50-edges-per-frame, to validate/refute the
edge-interrupt glitch-noise hypothesis.
This commit is contained in:
edisondeng
2026-07-31 15:53:15 +08:00
parent 18d272aac9
commit 29194a4f5d
4 changed files with 208 additions and 176 deletions

View File

@@ -55,6 +55,7 @@ volatile u16 comb_hold = 0; // ▲ + ▼ 组合键按下时长累
* - '1'/'2'/'3': 模拟系统的正常、已布防、已撤防状态切换。
* - 'z'/'Z': 模拟超时,强行使闲置计数器置 6000触发自动深度休眠。
* - 't'/'T': 触发屏幕与无线控制引脚测试。
* - 'e'/'E': DEBUG打印 RF 边沿中断解码排查计数器。
*/
/**
* @brief 串口调试专属RGB 物理颜色通道排查测试
@@ -191,13 +192,17 @@ void Debug_ProcessCommand(char cmd)
RF_DiagnosticMode('r'); // 触发 5 秒射频接收监听诊断
} else if (cmd == 'l' || cmd == 'L') {
Loopback_Test(); // 触发物理电气回环测试 (短路 P2.1 和 P3.6 自检)
} else if (cmd == 'e' || cmd == 'E') {
RF_PrintDebugCounters(); // DEBUG: 打印 RF 边沿中断解码排查计数器
}
}
// ====== 调试用最小化启动开关 ======
// 置 1 时 main() 只做点亮屏幕这一件事RF/自检/数据库/事件框架/Timer1 全部跳过,
// 用于定位"开机反复重启"问题的范围。定位完成后改回 0恢复正常启动流程。
#define DEBUG_MINIMAL_BOOT 1
// 用于定位"开机反复重启"问题的范围。
// 根因(isr_jump.asm 缺少 Port3 中断向量重定向、且该文件从未加入工程编译)已定位并修复,
// 现改回 0恢复完整正常启动流程测试整机端到端是否稳定。
#define DEBUG_MINIMAL_BOOT 0
/* =========================================================================
* 主函数 (入口)
@@ -221,11 +226,14 @@ void main(void)
Uart1_Init(); // 初始化串口 1 波特率 115200 供调试日志
Uart_SendString("Wristband System Initialized! (DEBUG_MINIMAL_BOOT=1, step A: RF_Init+Timer1_Init)\r\n");
Timer1_Init(); // 全局中断 EA=1 从这里开始生效Timer0 溢出中断与 P3.6 边沿中断真正开始工作
// 注意:已恢复到步骤 A不调用 RF_SetMode(1)RF 芯片保持关闭状态
Timer1_Init(); // 全局中断 EA=1 从这里开始生效Timer0 溢出中断开始工作
LCD_ShowStringCentered(100, "STEP A OK", COLOR_WHITE, COLOR_BLACK);
LCD_ShowStringCentered(130, "RF_Init+Timer1", COLOR_GRAY, COLOR_BLACK);
// ====== 步骤 C真正的病根 (isr_jump.asm 缺少 Port3 重定向、且该文件从未被加入工程编译) 已修复,
// P3.6 中断与 RF_HandleEdgeInterrupt 都已恢复为正常逻辑,现在测试真实功能是否稳定 ======
RF_SetMode(1);
LCD_ShowStringCentered(100, "STEP C OK", COLOR_WHITE, COLOR_BLACK);
LCD_ShowStringCentered(130, "ISR fixed", COLOR_GRAY, COLOR_BLACK);
while (1) {
Delay_ms(1);
@@ -346,13 +354,14 @@ void Port2_Isr(void) interrupt 15
* @brief Port3 端口掉电中断服务函数 (由 isr_jump.asm 引导定位至此)
* @details P3.6 (RF_RX_DATA) 双边沿中断现在改为常态开启 (见 RF_Init()),身兼两职:
* 1. 休眠期间作为唤醒源,记录 p3_wakeup_flag 供 Wakeup_Restore() 判定唤醒来源;
* 2. 正常运行期间驱动 RF_HandleEdgeInterrupt() 增量解码 EV1527 信号。
* 不再像旧版那样在首次触发后自行关闭 P3INTE否则第 2 项功能会在第一次边沿后失效
* 2. DEBUG 对照实验期间,RF_HandleEdgeInterrupt() 只做纯边沿计数,不参与解码
* (真正的解码已改回 EV1527_Decode() 里的阻塞轮询实现,用于对照验证)
* 不再像旧版那样在首次触发后自行关闭 P3INTE否则第 1 项唤醒功能会在第一次边沿后失效。
*/
void Port3_Isr(void) interrupt 16
{
EAXFR = 1; // 使能访问扩展寄存器
p3_wakeup_flag = P3INTF | 0x01;// 读取并备份 P3 中断标志寄存器值 (0x01作安全掩码)
P3INTF = 0x00; // 清除 P3 端口中断悬挂标志位
RF_HandleEdgeInterrupt(); // 驱动 EV1527 边沿增量解码状态机
RF_HandleEdgeInterrupt(); // DEBUG: 纯边沿计数,不参与解码
}