新增其他协议切换PD时先进行一次完整的断开线处理,包含D+D-,CC线,GND,VBUS,然后再发送复位,待复位后再重新设置
1. apps/chrg/applications/thread/chrg_north.h:调整北向调试宏默认配置 2. apps/chrg/applications/utils/chrg_source.h:新增Source全复位与初始化等待状态枚举 3. apps/chrg/applications/bsp/chrg_gpio.h:补充北向继电器引脚注释,明确功能对应关系 4. apps/chrg/applications/thread/chrg_comm.c:优化Source复位触发条件,仅非PD转PD执行全复位 5. apps/chrg/applications/utils/chrg_eload.c/h:新增南向板版本读取与解析接口,新增版本就绪校验逻辑 6. apps/boot/application/main.c:完善boot跳转APP逻辑,注释原循环运行代码 7. apps/chrg/applications/thread/chrg_roll_nor.c:新增INIT_WAIT状态处理,调整复位后流程与sub推进逻辑 8. apps/chrg/applications/thread/chrg_roll_sou.c:新增南向版本就绪标记,上电先读取版本再启动常规采集 9. apps/chrg/applications/utils/chrg_source.c:实现全复位流程与初始化等待状态处理函数
This commit is contained in:
@@ -179,6 +179,14 @@ int chrg_eload_read_regs (rt_uint8_t addr, rt_uint16_t reg, rt_uint16_t len)
|
||||
return chrg_south_send(buf, 8);
|
||||
}
|
||||
|
||||
/* Read the version first so a newly powered south board is not queried with
|
||||
* the long measurement frame before its Modbus interface is ready. */
|
||||
int chrg_eload_read_version (rt_uint8_t addr)
|
||||
{
|
||||
return chrg_eload_read_regs(addr, MODBUSRTU_SW_VERSION_REG,
|
||||
MODBUSRTU_SW_VERSION_LEN);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
函数名称: chrg_eload_send_ymodem_data
|
||||
函数描述: 向南向发送ymodem协议升级数据
|
||||
@@ -292,6 +300,24 @@ int chrg_eload_refresh (rt_uint8_t addr, rt_uint8_t part)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int chrg_eload_parse_version (rt_uint8_t idx, rt_uint8_t *data, rt_uint16_t len)
|
||||
{
|
||||
rt_uint16_t version;
|
||||
|
||||
/* A one-register Modbus 0x03 response is 7 bytes including CRC16. */
|
||||
if ((idx >= TOTAL_SOU_CHS) || (data == RT_NULL) ||
|
||||
(len != (MODBUSRTU_SW_VERSION_LEN * 2U + 5U)) ||
|
||||
(data[0] != ID_ELOAD) || (data[1] != MB_REGISTER_RD) ||
|
||||
(data[2] != 2U) || (mb_crc16(data, len) != 0U)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
version = u8v_to_u16(&data[3]);
|
||||
/* HOLD_REG_CH0_VERSION is the per-channel south board version register. */
|
||||
usRegHoldBuf[HOLD_REG_CH0_VERSION + idx * TOTAL_HOLD_CH_REGS] = version;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
函数名称: chrg_eload_parse
|
||||
函数描述: 解析源载返回数据
|
||||
|
||||
Reference in New Issue
Block a user