diff --git a/apps/chrg/applications/thread/chrg_comm.c b/apps/chrg/applications/thread/chrg_comm.c index b0d2fe3..a64ee3b 100644 --- a/apps/chrg/applications/thread/chrg_comm.c +++ b/apps/chrg/applications/thread/chrg_comm.c @@ -27,7 +27,7 @@ #include "stm32f4xx_hal.h" #define HOLD_REG_FIRMWARE_VERSION 0x0300U /* 协议板固件版本,只读 */ -#define CHRG_FIRMWARE_VERSION 0x0143U /* 当前协议板版本:V1.1.51 */ +#define CHRG_FIRMWARE_VERSION 0x0144U /* 当前协议板版本:V1.1.52 */ rt_uint8_t ucDiscInBuf[(TOTAL_DISC_REGS+BITS_UCHAR-1)/BITS_UCHAR]; diff --git a/apps/chrg/applications/thread/chrg_roll_sou.c b/apps/chrg/applications/thread/chrg_roll_sou.c index 5936466..e0b00a8 100644 --- a/apps/chrg/applications/thread/chrg_roll_sou.c +++ b/apps/chrg/applications/thread/chrg_roll_sou.c @@ -1010,6 +1010,14 @@ void chrg_roll_sou_thread_entry (void *data) LOG_HEX("sendY", 32, pROLL->updata_buf, pROLL->leng); #endif ret = chrg_eload_send_ymodem_data(pROLL->updata_buf, pROLL->leng); + #if SOUTH_YMODEM_DEBUG + rt_kprintf("south ymodem tx: ch=%u len=%u ret=%d\r\n", + single_ch + 1U, pROLL->leng, ret); + #endif + if (ret != (rt_err_t)pROLL->leng) { + LOG_E("ymodem tx failed: ch=%u expected=%u ret=%d", + single_ch + 1U, pROLL->leng, ret); + } rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER); pROLL->updata_result = (rt_int16_t)ret; diff --git a/apps/chrg/applications/utils/chrg_def.h b/apps/chrg/applications/utils/chrg_def.h index 28c3a18..f9f69ff 100644 --- a/apps/chrg/applications/utils/chrg_def.h +++ b/apps/chrg/applications/utils/chrg_def.h @@ -14,8 +14,8 @@ /* CHRG application version. Keep this value synchronized with the changelog. */ #define CHRG_VERSION_MAJOR 1U #define CHRG_VERSION_MINOR 1U -#define CHRG_VERSION_PATCH 51U -#define CHRG_VERSION_STRING "V1.1.51" +#define CHRG_VERSION_PATCH 52U +#define CHRG_VERSION_STRING "V1.1.52" /* * Channel polling mode: diff --git a/apps/chrg/applications/utils/chrg_ymodem_proxy.c b/apps/chrg/applications/utils/chrg_ymodem_proxy.c index 5fb3d05..4462095 100644 --- a/apps/chrg/applications/utils/chrg_ymodem_proxy.c +++ b/apps/chrg/applications/utils/chrg_ymodem_proxy.c @@ -25,6 +25,7 @@ typedef struct { rt_uint8_t ch; // 被锁定的南向功率板通道 rt_uint8_t expected_packet; // PC下一帧应使用的包号 rt_uint8_t current_packet; // 当前已转发帧的包号,仅用于日志 + rt_uint16_t tx_length; // 当前已提交南向的帧长度 rt_uint8_t meta_ack_seen; // 元数据ACK已收到,后续才接受'C' rt_uint8_t eot2_ack_seen; // 第二个EOT的ACK已收到 rt_uint16_t rx_len; // 北向当前已拼接字节数 @@ -209,6 +210,7 @@ static int chrg_ymodem_proxy_submit_frame(const rt_uint8_t *frame, int ret = chrg_send_sou_upadata_data(frame, length); if (ret != 0) return ret; g_proxy.current_packet = (length > 1U) ? frame[1] : 0U; + g_proxy.tx_length = length; g_proxy.state = next_state; g_proxy.response_tick = rt_tick_get(); g_proxy.activity_tick = g_proxy.response_tick; @@ -484,6 +486,18 @@ rt_uint16_t chrg_ymodem_proxy_poll(rt_uint8_t *output, chrg_ymodem_proxy_session_stop(); return 0U; } + if ((g_proxy.state == YMODEM_PROXY_WAIT_META_RESP || + g_proxy.state == YMODEM_PROXY_WAIT_DATA_RESP || + g_proxy.state == YMODEM_PROXY_WAIT_EOT1_RESP || + g_proxy.state == YMODEM_PROXY_WAIT_EOT2_RESP || + g_proxy.state == YMODEM_PROXY_WAIT_END_ACK) && + (chrgrollsou.send_flag == 0U) && + (chrgrollsou.updata_result != (rt_int16_t)g_proxy.tx_length)) { + LOG_E("south tx incomplete: ch=%u expected=%u ret=%d", + g_proxy.ch + 1U, g_proxy.tx_length, + chrgrollsou.updata_result); + chrg_ymodem_proxy_abort("south send failed"); + } response = chrg_eload_get_ymodem_resp(); if (response != 0U) chrg_ymodem_proxy_handle_south(response); if ((g_proxy.expected_len != 0U) && (g_proxy.rx_tick != 0U) && diff --git a/docs/修改日志.md b/docs/修改日志.md index 7e765f8..6436116 100644 --- a/docs/修改日志.md +++ b/docs/修改日志.md @@ -1,5 +1,13 @@ # 修改日志 +## V1.1.52 - 2026-09-29 + +### 南向YMODEM发送结果校验 + +- 校验 UART6 写入返回长度;短写或失败立即记录通道、期望长度和实际返回值。 +- 南向帧未完整写入时立即取消升级会话,不再错误等待南向ACK超时。 +- 协议板版本寄存器 `0x0300` 更新为 `0x0144`。 + ## V1.1.51 - 2026-09-29 ### 南向Boot主动握手