refactor: Modbus 默认波特率 115200 + 资源分析重评估

分析结论 (115200 vs 9600):
- TX 阻塞: 4.3ms (曾 44.8ms) → 活动态 CPU 仅 +2.9%
- 主循环延迟 < 半个测量窗, 不影响线圈检测/光耦/BLE
- 从"临界可用"变为"完全充裕"

固件修复:
- rs485_init: 硬编码 RS485_BAUD → 使用 g_storage_uart_baud (flash 可配)
- 协议文档: Modbus 默认 115200
- DLD154Tool: 串口默认 115200
This commit is contained in:
wangfq
2026-07-30 17:39:27 +08:00
parent 2088cc267c
commit 2142674c3e
5 changed files with 40 additions and 37 deletions
@@ -50,7 +50,7 @@ void rs485_init(void)
GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA);
/* UART0 外设: 9600 8N1 */
UART0_BaudRateCfg(RS485_BAUD);
UART0_BaudRateCfg(g_storage_uart_baud); /* 使用 flash 存储的波特率 (700BS=9600, Modbus=115200) */
R8_UART0_LCR = 0x03; // 8 数据位, 1 停止位, 无校验
R8_UART0_MCR = 0x04; // RE=0 进入接收模式