Files
DCU_APP/GD32E508_DCU_APP/sys/initial.h
T
cbb fedd39b902 feat(canfd): 添加CANFD硬件自检功能并优化初始化时序
- 新增s_channelHwOk数组跟踪各通道硬件初始化状态
- 修改CANFD初始化流程,在GPIO上电后延时200ms再进入Normal模式
- 实现selfTestL0()轻量自检函数,检查硬件初始化、退出init模式、收发器状态等
- 更新CANFD初始化逻辑,只有自检通过才标记为成功

refactor(spi): 调整SPI DMA和EXTI配置顺序避免通信失步

- 将armSpiDmasForNextCs()调用移至configureExti()之前
- 添加注释说明DMA预装和EXTI开启的时序要求
- 避免OTA跳转后ESP32立即发送HELLO导致的SPI从机失步问题

fix(app_spi): 修复HELLO_ACK响应中credit初始化问题

- 在HELLO_ACK构建前将g_localCredit设置为1
- 与requestEsp32Read()保持一致避免TX占用时credit=0的问题
- 防止主机因remoteCredit=0而拒绝发送PING帧

refactor(initial): 重构应用初始化流程添加模块状态跟踪

- 引入ModuleBit枚举和掩码机制跟踪各模块初始化状态
- 实现mark()和report()方法统一管理模块启动结果
- 按NVIC→SysTick→ESP32_EN→USART0→AppSpi→ADC→CANFD→OTA→TaskManager→Scheduler→EtherCAT→Watchdog顺序启动
- 将CANFD模块成功条件改为selfTestL0()通过才标记成功
2026-07-17 02:03:00 +08:00

42 lines
1022 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef SYS_INITIAL_H
#define SYS_INITIAL_H
#include <stdint.h>
#include <stdbool.h>
/**
* @brief 应用初始化器:按固定顺序启动模块,成功位置 1,末尾汇总。
*/
class AppInitializer {
public:
/** 启动模块位(成功置 1) */
enum ModuleBit : uint32_t {
kNvic = 1u << 0,
kSysTick = 1u << 1,
kEsp32Hold = 1u << 2,
kUsart0 = 1u << 3,
kAdc = 1u << 4,
kCanFd = 1u << 5,
kOtaBootReq = 1u << 6,
kAppSpi = 1u << 7,
kTaskManager = 1u << 8,
kScheduler = 1u << 9,
kEthercat = 1u << 10,
kEthercatSync = 1u << 11,
kWatchdog = 1u << 12,
};
/**
* @brief 按固定顺序完成模块初始化(过程只置位,结束统一报告成败/失败模块)。
*/
static void init();
private:
static uint32_t s_mask;
static void mark(ModuleBit b);
static void report();
};
#endif /* SYS_INITIAL_H */