fix(rf): true single-edge P3.6 trigger + pull-down, restore edge decode
Root cause found via datasheet: PxIM0/PxIM1 has no dual-edge mode, only falling/rising/low-level/high-level. (IM1=1,IM0=1) was actually high-level interrupt, refiring continuously for the whole high-pulse duration (confirmed by scope: no real HF noise, and edge_count=0 when P3.6 grounded). Fix: start in rising-edge mode, software-toggle to the opposite edge on every trigger (ping-pong) to emulate true dual-edge triggering, feeding exact edge direction into the incremental decode state machine (no glitch filter needed). Also switch P3.6 idle bias from pull-up to pull-down, since floating-high under the old high-level mode caused the interrupt-storm boot issue; removed the now-conflicting pull-up restore in Wakeup_Restore().
This commit is contained in:
11
App/main.c
11
App/main.c
@@ -352,10 +352,11 @@ 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. DEBUG 对照实验期间,RF_HandleEdgeInterrupt() 只做纯边沿计数,不参与解码
|
||||
* (真正的解码已改回 EV1527_Decode() 里的阻塞轮询实现,用于对照验证)。
|
||||
* @details P3.6 (RF_RX_DATA) 单边沿触发中断现在改为常态开启 (见 RF_Init()),身兼两职:
|
||||
* 1. 休眠期间作为唤醒源,记录 p3_wakeup_flag 供 Wakeup_Restore() 判定唤醒来源
|
||||
* (上升沿/下降沿均支持掉电唤醒);
|
||||
* 2. 正常运行期间驱动 RF_HandleEdgeInterrupt() 增量解码 EV1527 信号 (内部会在
|
||||
* 每次触发后软件翻转到相反边沿,模拟双边沿触发)。
|
||||
* 不再像旧版那样在首次触发后自行关闭 P3INTE,否则第 1 项唤醒功能会在第一次边沿后失效。
|
||||
*/
|
||||
void Port3_Isr(void) interrupt 16
|
||||
@@ -363,5 +364,5 @@ void Port3_Isr(void) interrupt 16
|
||||
EAXFR = 1; // 使能访问扩展寄存器
|
||||
p3_wakeup_flag = P3INTF | 0x01;// 读取并备份 P3 中断标志寄存器值 (0x01作安全掩码)
|
||||
P3INTF = 0x00; // 清除 P3 端口中断悬挂标志位
|
||||
RF_HandleEdgeInterrupt(); // DEBUG: 纯边沿计数,不参与解码
|
||||
RF_HandleEdgeInterrupt(); // 驱动 EV1527 边沿增量解码状态机
|
||||
}
|
||||
|
||||
@@ -390,9 +390,8 @@ void Wakeup_Restore(void)
|
||||
P0INTE = 0x00;
|
||||
P2INTE = 0x00;
|
||||
P3INTE = 0x40;
|
||||
// 恢复休眠前被 Enter_Low_Power_Sleep() 关闭的 P3.6 内部上拉:LR690L 在 SHUT=1 期间数据脚
|
||||
// 高阻悬空,配合常态开启的 P3.6 中断会引发中断风暴,唤醒后必须立刻用上拉钳住电平
|
||||
P3PU |= 0x40;
|
||||
// P3.6 的悬空钳位已改用内部下拉 (P3PD,在 RF_Init() 里一次性永久开启,Power Down 期间
|
||||
// SFR 状态保持不变,无需在这里重新配置);此处不再恢复上拉,避免上拉与下拉同时使能相互打架
|
||||
|
||||
P0WKUE = 0x00;
|
||||
P2WKUE = 0x00;
|
||||
|
||||
Reference in New Issue
Block a user