feat(project): 更新项目配置并增加ESC EEPROM功能
- 添加新的SPI命令文件:app_spi_cmd_can_burst.cpp 和 app_spi_cmd_exmc_diag.cpp - 移除旧的SPI命令文件:app_spi_cmd_ota_wait.cpp, app_spi_cmd_ping.cpp, app_spi_cmd_can_bridge.cpp, app_spi_cmd_can_feedback.cpp, app_spi_cmd_id_snapshot.cpp, app_spi_cmd_adc_feedback.cpp, app_spi_cmd_motor_state.cpp, app_spi_cmd_motor_version.cpp, app_spi_cmd_motor_ota.cpp - 新增SSC EtherCAT从站协议栈相关文件组,包含头文件和源文件 - 添加ESC EEPROM操作相关的头文件和源文件 - 修正HBI寄存器EXMC偏移地址映射错误 - 实现8位、16位、32位ESC寄存器读写函数 - 改进EEPROM初始化逻辑,添加重试机制和诊断功能
This commit is contained in:
@@ -20,9 +20,15 @@
|
||||
#include "sys/ota_boot_request.h"
|
||||
#include "sys/task_manager.h"
|
||||
#include "sys/config.h"
|
||||
#include "comm/esc_lan9252.h"
|
||||
#include "comm/ethercat_slave.h"
|
||||
#include "comm/ethercat_sync.h"
|
||||
|
||||
extern "C" {
|
||||
uint16_t MainInit(void);
|
||||
void MainLoop(void);
|
||||
}
|
||||
|
||||
uint32_t AppInitializer::s_mask = 0U;
|
||||
|
||||
namespace {
|
||||
@@ -137,11 +143,20 @@ void AppInitializer::init()
|
||||
SchedulerTimer::init();
|
||||
mark(kScheduler);
|
||||
|
||||
EthercatSlave::init();
|
||||
if (EthercatSlave::isEscReady()) {
|
||||
mark(kEthercat);
|
||||
EthercatSync::init();
|
||||
mark(kEthercatSync);
|
||||
/* ---- EtherCAT: EXMC 总线探活 → SSC 协议栈初始化 → SYNC0/IRQ 中断使能 ----
|
||||
* EEPROM 校验/烧录延迟到主循环执行,避免阻塞 init(烧录需 ~20s)。 */
|
||||
if (EscLan9252::init()) {
|
||||
const uint16_t sscResult = MainInit();
|
||||
if (sscResult == 0U) {
|
||||
mark(kEthercat);
|
||||
EthercatSync::init();
|
||||
mark(kEthercatSync);
|
||||
printf("[ECAT] SSC MainInit OK, sync ISR enabled\r\n");
|
||||
} else {
|
||||
printf("[ECAT] SSC MainInit FAIL (code=0x%04X)\r\n", (unsigned)sscResult);
|
||||
}
|
||||
} else {
|
||||
printf("[ECAT] EXMC bus not ready, SSC skipped\r\n");
|
||||
}
|
||||
|
||||
Watchdog::init();
|
||||
|
||||
Reference in New Issue
Block a user