feat(adc): 1 kHz 采样节拍改由 TIM6 硬件定时器触发

- CubeMX 加 TIM6(PSC=83 / ARR=999 / ARR 预装载 / NVIC 抢占优先级 6)
- Src/main.c 回调加 TIM6 分支触发 CONVST(USER CODE 区)
- app_main.c 用 HAL_TIM_Base_Start_IT(&htim6) 替换单次触发
- adc_task.c 退化为纯消费者(1 ms 轮询仅作消费节奏)
- @build 0 错 0 警;台架 @test 验收待做
- 同步 ADC采样节拍设计说明 / 继电保护复现规划 / AGENTS / TPAFE README
This commit is contained in:
2026-10-10 15:24:02 +08:00
parent f0300761ae
commit 970e574433
18 changed files with 4427 additions and 74 deletions
+5 -2
View File
@@ -17,6 +17,7 @@
#include "main.h" /* ST_DIR4_GPIO_Port / ST_DIR4_Pin 等 CubeMX 宏 */
#include "stm32f4xx_it.h" /* fault_handler_enable() */
#include "usart.h" /* huart5 */
#include "tim.h" /* htim6:1 kHz 采样节拍(TIM6 更新中断触发 CONVST) */
#include "rs485.h"
#include "sd2506.h"
#include "sys_clock.h"
@@ -209,8 +210,10 @@ int app_main_init(void) {
sd_vbat / 1000, (sd_vbat % 1000) / 10);
}
/* 6) 启动第一次转换(CubeMX 已配置 BUSY EXTI 中断) */
tpafe5160_start_conv_irq();
/* 6) 启动 1 kHz 采样节拍:TIM6 更新中断 → ISR 内触发 CONVST(Src/main.c)。
* ⚠ 必须在 tpafe5160_init() 成功之后启动,否则 ISR 会在驱动首帧自检
* (E-44 有效性探针)期间乱发 CONVST。消费端 adcTask 退化为纯消费者。 */
(void)HAL_TIM_Base_Start_IT(&htim6);
DBG_INFO("App init OK");
return 0;