36 Commits

Author SHA1 Message Date
evan.liu
ea1dbe4230 状态灯: LED1(PB1)运行心跳 + LED2(PB2)蓝牙连接指示 (APP V1.00.42)
- LED1 改 PB1(运行心跳闪灯, 半周期=led1_blink_ms), LED2 改 PB2(蓝牙连接亮灯)
- main.c 新增 led_task 心跳 + 启动 LedInit/LedOff(LED2)
- app_ble.c connected/disconnected 控制 LED2 亮灭
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §71
2026-09-13 14:18:33 +08:00
evan.liu
f34efe9070 apptest 删除, 功能合入 disptest (APP V1.00.41)
- disptest 合并两段: 快速位检查(0-9/多位数/999.9/36.5F-C) + 全量程扫测(0.1-999.0 C+F)
- 删除 apptest 命令与 CmdAppTest
- 说明书 §8 同步(删除 apptest, 更新 disptest), 补 §4.1 三态驱动防鬼影说明
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §70
2026-09-13 13:47:12 +08:00
evan.liu
44172e861a 整理《数码管显示设计说明书》(仅文档)
- 新增 docs/数码管显示设计说明书.md: 汇总当日数码管联调成果
  (脚号映射/位序/Charlieplexing公式/段码表/温度解码/软件接口/CLI命令/踩坑/示例)
- docs/开发日志.md: 新增 §69
2026-09-13 10:45:16 +08:00
evan.liu
03fda56396 apptest 改为温度量程扫测 0.1-999.0 (摄氏+华氏) (APP V1.00.40)
- apptest: 0.1~9.9(0.1) -> 10~99(1) -> 100~990(10) -> 999.0, 先C后F各扫一遍
- 保留 display_set_raw 供后续状态显示(Err/Lo/Hi)用
- 显示不做F/C换算, 华氏/摄氏只影响DIG4字母与DIG6-A
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §68
2026-09-13 10:02:19 +08:00
evan.liu
ed2cf2a29d 新增 apptest 全字符显示自检 (0-9/A-F) (APP V1.00.39)
- display_set_raw(digits[5], type) + 裸码模式: 绕过温度解码直接渲染段位字符
- apptest: 循环 0-15, 四数字位同显一字符, DIG4 固定 C
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §67
2026-09-13 09:55:51 +08:00
evan.liu
dec34cfe0e DIG4 单位字母改 F/C (华氏F/摄氏C) (APP V1.00.38)
- display_decode 增加 type 入参, DIG4 按类型写 F(0x0F)/C(0x0C)
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §66
2026-09-13 09:50:02 +08:00
evan.liu
39e55e867d 修正数码管位序: DIG4=固定F, DIG5=小数位 (APP V1.00.37)
- 布局: DIG1百位/DIG2十位/DIG3个位/DIG4固定F/DIG5小数位; DIG6-A华氏, DIG6-B小数点
- display_decode 重写为温度位序, 钳位 0~999.9, 删除 hex 解码
- disp 去掉 hex 模式; 删除 cli_parse_hex; disptest 序列改为温度值
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §65
2026-09-13 09:46:28 +08:00
evan.liu
d697885694 新增 disptest 数码管自动化显示自检 (APP V1.00.36)
- disptest: 自动循环 0.0~9.0 -> 88888(全段) -> ABCDE(hex) -> 72.0F -> -123.4
- 测试期间强制开自动扫描, 结束恢复原 auto 状态并回 0.0
- 复核段位公式/管脚表/DIG6 指示段/解码逻辑, 无其它缺陷(除已修 GPIOA 时钟)
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §64
2026-09-13 09:36:27 +08:00
evan.liu
a4442c14a5 修复 PA0/PA1 拉高无输出: GPIOA 时钟未使能 (APP V1.00.35)
- 根因: LedInit 删除后 GPIOA 时钟无人使能, GPIOB 因 USART 仍使能
- 修复: display_task 开头使能 GPIOA+GPIOB; cli_disp_set_pin 再防御性使能
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §63
2026-09-13 09:31:22 +08:00
evan.liu
c9c1d474a7 dispset 增加 all 一键全管脚设置 (APP V1.00.34)
- dispset all 0/1/z: 一次把数码管 7 个管脚全部拉高/拉低/置高阻
- 抽出 cli_disp_set_pin() 单脚驱动, 单脚与 all 共用
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §62
2026-09-13 09:25:15 +08:00
evan.liu
fb681a4b69 数码管手动管脚控制: dispauto 开关 + dispset 命令 (APP V1.00.33)
- dispauto [on|off]: 关掉自动显示扫描, 7 脚置高阻, 供手动控制
- dispset <pin1-7> [0|1|z]: 手工驱动数码管 pin1~7 (pin1=PB0..pin7=PA6)
- app_display.c: g_disp_auto + display_auto_set/get + display_pin_map,
  display_task 自动关时释放管脚并让出
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §61
2026-09-13 09:12:02 +08:00
evan.liu
a93d2919a0 CLI 新增 disp 数码管显示值命令 (APP V1.00.32)
- disp <value> [f] [hex]: 设置 7 段数码管显示数值
  - 默认十进制 1 位小数 °C; f 点亮 °F 指示段; hex 按十六进制整数显示
- 手写 cli_parse_float/cli_parse_hex (不依赖 MicroLIB atof/strtod)
- 背景: 数码管 display_task 之前无任何任务调用 display_set(), 一直显示静态 0
- 仅 APP 改动, Boot 不动 (仍 V1.00.07)
- docs/开发日志.md: 新增 §60
2026-09-12 10:14:58 +08:00
evan.liu
3d6567819a CLI 新增 pinset 管脚高低电平命令 (Boot V1.00.07 / APP V1.00.31)
- pinset <pxN> [0|1]: 设置 GPIO 输出高低 / 读当前电平 (pa0-6/pb0-13)
- Boot/src/boot_cli.c + mcm-ddc-ble/src/cli_core.c 各加一份同名命令
- 对 SWD(PA4/PA5) / 控制台(PB6/PB7) 重配前打印 warning
- Boot V1.00.06 -> V1.00.07; APP V1.00.30 -> V1.00.31 (0x0001001F)
- docs/开发日志.md: 新增 §59
2026-09-12 09:58:55 +08:00
evan.liu
e74751634b YF30137 七脚数码管显示驱动(Charlieplexing) + 取消 Boot strap 下载检测 (APP V1.00.30 / Boot V1.00.06) 2026-09-06 20:11:53 +08:00
evan.liu
5917cafb0c CLI help 增加运行模式标识 + Boot 版本号改 1.00.XX
- help 首行打印 mode: Boot 用 'mode: BOOT download' / App 用 'mode: APP'
- Boot/src/boot_version.h: V1.01.04 -> V1.00.05 (版本格式对齐 APP 的 1.00.XX)
- mcm-ddc-ble: app_version V1.00.28 -> V1.00.29 (0x0001001D)
- docs/开发日志.md: 新增 §57
2026-09-06 09:09:18 +08:00
evan.liu
8b1744744e boot V1.01.04: download CLI 移植 UP/DOWN 历史导航
- Boot/src/boot_cli.c: 命令历史环形缓冲(8条) + ESC [ A/B 箭头历史导航,
  回车入栈/重画提示符+整行, shownLen 同步维护
- help 提示串更新为 'keys: TAB = complete, UP/DOWN = history' (与 APP 一致)
- Boot/src/boot_version.h: V1.01.03 -> V1.01.04
- docs/开发日志.md: 新增 §56
2026-09-06 08:58:01 +08:00
evan.liu
17e814a883 boot V1.01.03: download CLI help 追加 'keys: TAB = complete' 提示串
- Boot/src/boot_cli.c: CmdHelp 无参分支在命令表后打印 keys 提示串(对齐 APP 的 help)
- 撤回 ready banner 临时加的 (TAB = complete),提示只放 help,与 APP 风格一致
- Boot/src/boot_version.h: V1.01.02 -> V1.01.03
- docs/开发日志.md: 新增 §55
2026-09-06 08:50:00 +08:00
evan.liu
9dad3daf61 boot V1.01.02: 3.3V strap 进入 download + CLI TAB 命令补全
- Boot/src/main.c: PB5 3.3V strap 引脚 (输入+内部下拉), 拉高即进 download 并跳过 2s 回车窗口 (dev log §53)
- Boot/src/boot_cli.c: 从 APP 移植 TAB 命令名自动补全 (单匹配补全+空格, 多匹配公共前缀/列候选) (dev log §54)
- Boot/src/boot_version.h: V1.01.00 -> V1.01.02
- docs/开发日志.md: 新增 §53/§54
- 出包: mothercup_ble_prod.hex/bin 更新 (boot bin 13580B)
2026-09-06 06:40:55 +08:00
evan.liu
f4faf68ed8 boot V1.01.00: UART download mode (CLI + OTA frame upgrade in bootloader)
- boot_usart: bare-metal USART1 460800, polled TX, 3KB DMA ring RX, SysTick millis
- boot_cli: polled line editor + mini printf + command subset; wire-compatible
  with the app UART CLI (prompt/devinfo cur bank/ota marker) so
  ble_ota_update.py --uart works unchanged against the bootloader
- share app_ota.c/app_bootset.c into the Boot build via BOOT_FIRMWARE ifdef
  (single OTA engine source); frame constants moved to shared Boot/src/ota_wire.h
- entry: 2s Enter window after the boot banner, or forced when no jumpable
  image (invalid bootsetting + APP1 vector sanity fail) - brick recovery path
- OTA target in boot = inactive bank per bootsetting (APP1 when invalid)
- merge_image.py: hard-fail when boot bin exceeds the 16KB region
- APP V1.00.28 (shared-source touch only, behavior unchanged)
- tested: normal boot / download CLI / OTA APP1<->APP2 round trip / bricked
  recovery (bootsetting+APP1 sector erased -> forced download -> OTA restore)
- docs: dev log sec.52, ble_protocol sec.6.8, AGENTS.md
2026-09-05 17:25:53 +08:00
evan.liu
15ae64172a docs: dev log sec.51 - Boot download mode design (UART CLI + OTA in bootloader, not yet implemented) 2026-09-05 17:00:08 +08:00
evan.liu
e0253d1bbf fw V1.00.27: add IWDG watchdog (4s timeout, idle-hook fed with 3s task heartbeat window, DBG freeze, reset-cause banner) + 'hang' fire-test cmd 2026-09-05 13:53:20 +08:00
evan.liu
57762e50be tools: self-contained portable production package
- tools/python-embed/: embedded Python 3.12.10 runtime with bleak/pyserial
  preinstalled (git-ignored, fetched from the huaweicloud mirror); bats
  resolve Python in order: python-embed -> .venv-ble -> system
- NSpyocd.exe + DFP pack copied into tools/ (git-ignored);
  flash_package.py prefers the in-tools copies
- make_release.bat/ps1: one-click zip to out/mothercup_tools_<ts>.zip
  (staged in TEMP to avoid self-inclusion; zip excluded from git)
- all bats converted to CRLF (LF-only breaks cmd block parsing and %~dp0)
- verified: zip extracted outside the repo runs ble_ota --uart end-to-end
  (PASS, 27 kB/s) and flash_package via the bundled NSpyocd
- docs: dev log section 49, AGENTS.md tools section + heap 18KB fix
2026-09-05 10:34:59 +08:00
evan.liu
8a7cebcf77 V1.00.26: UART baud 115200 -> 460800
- firmware BSP_USART_BAUDRATE 460800 (divider error +0.03%); uartrst/
  uartinfo follow the macro
- RX DMA ring 2KB -> 3KB: at 460800 2KB only covers 44ms, less than the
  ~45ms flash-erase interrupt-off window; stack top now 0x2000BDE8
  (guard warns <1KB from the 0x2000C000 cliff, by design)
- tools: ble_ota_update.py UartTransport and uart_cap.py default baud
- Verified: stream OTA 55832B in 2.6s @23kB/s (one lost frame recovered
  by go-back-N), PASS after reboot; text CLI fine at 460800
- docs: ble_protocol.md, design spec, AGENTS.md, dev log section 48
2026-09-05 10:01:23 +08:00
evan.liu
f729d16ff2 V1.00.25: UART OTA stream mode + RX DMA ring + SRAM cliff fix
Firmware:
- bsp_usart: RX moved from RXDNE byte-queue IRQ to DMA CH2 circular ring
  (2KB) + IDLE-irq wakeup; bytes keep landing during flash-erase
  interrupt-off windows (the reason lockstep was needed before)
- app_ota: stream mode (ble_protocol.md section 6.7) - 16B BEGIN with
  flags bit0=STREAM (UART channel only), DATA acked on 4KB sector
  crossings (original chunk length; two ack-gating bugs fixed during
  field test), throttled BAD_STATE for go-back-N
- FreeRTOS heap 20KB->18KB: the 2KB ring pushed the stack top past the
  0x2000C000 SRAM cliff (probed via SWD: accesses above fault on this
  silicon, usable app SRAM is 32KB) which locked the board at boot;
  merge_image.py now hard-fails the package when the image initial SP
  leaves (0x20004000, 0x2000C000]

Tools:
- ble_ota_update.py: UART stream sender (8KB window, stall watchdog
  rewind, auto-fallback to lockstep on pre-V1.00.24 firmware,
  --lockstep to force); case-insensitive option parsing
- flash_package.py/bat: stream NSpyocd output live (chunked reads keep
  the \r progress bar), vendor banner rebranded to CAIIC NSLINK UMP
- merge_image.py: initial-SP cliff guard

Verified: UART stream OTA both directions, 55.8KB in ~5.9s @9.5kB/s
0 rewinds (lockstep was 39s), PASS after reboot; board boot fixed and
verified via SWD.

Docs: ble_protocol.md section 6.7, dev log section 47 (+ SRAM cliff
post-mortem), AGENTS.md RAM rule rewritten (both cliffs) + V1.00.25
2026-09-05 09:48:28 +08:00
evan.liu
30b5dd908b docs: add design specification (architecture/protocol/conventions/extension guide) 2026-09-05 08:16:50 +08:00
evan.liu
ead16ef671 V1.00.23 + OTA tool fine-grained progress display
- firmware version bump V1.00.22 -> V1.00.23 (0x00010017), no code change;
  user-verified BLE OTA (APP1->APP2) and UART OTA both PASS
- ble_ota_update.py: frame-level live progress bar on tty (bar/pct/bytes/
  rate/per-frame ack RTT, ~10fps throttled), 5%-step lines when redirected;
  resend/resync notices no longer mix into the bar line; END summary now
  reports resent/resynced counters; BEGIN/END stage banners
- docs: dev log 46, AGENTS.md sync
2026-09-04 21:33:25 +08:00
evan.liu
5dcbdbad65 V1.00.22 + OTA tool bank-misselection fix (triple protection)
- firmware: version bump to V1.00.22 (0x00010016), no code change
- ble_ota_update.py: cur-bank detection now reads the full devinfo output
  and parses strictly (early break at the 'cur bank:' prefix could miss
  'APP2' and silently default to APP1 -> wrong payload selection, caught
  by the device bank_mismatch guard on hardware)
- new pre-flight check_blob_bank(): payload vector reset PC must land in
  the target bank before transferring (BLE and UART paths)
- UART path: post-reboot verification over the text CLI (bank+version),
  deterministic PASS/FAIL like the BLE path
- verified: UART OTA APP2->APP1 V1.00.22 full pass with auto-verify
- docs: dev log 45, AGENTS.md sync
2026-09-04 20:49:15 +08:00
evan.liu
efc7bd129f V1.00.21: UART OTA channel verified + mode-switch handshake + loss-tolerant lockstep
- UART binary mode switch mechanism: enter handshake marker '[ota] binary
  mode ON', explicit exit via OTA_ABORT (immediate), 10s idle fallback
  (was 3s, must exceed the host retry window); host resync by CR probe
- fix: otaIdleMs not re-armed on mode entry - every second 'ota' entry was
  kicked out by an instant idle timeout (leftover count from prior session)
- lossy-link tolerance: device drops partial frames after a 100ms byte gap
  so host resends re-align; OTA session is now single-owner (second BEGIN
  on another channel gets BAD_STATE)
- ble_ota_update.py: wait for the enter marker instead of blind sleeps,
  per-frame resend (2s x3), BAD_STATE+expected-offset treated as implicit
  ack for duplicate DATA/BEGIN (resync after ack loss), stage-labeled
  timeouts with raw-rx dump
- verified on hardware: UART OTA full pass (55.7KB/41s, 4-5 lost frames
  auto-recovered) + BLE OTA regression pass; docs: dev log 44,
  ble_protocol.md 6.6 rework, AGENTS.md sync
2026-09-04 20:19:00 +08:00
evan.liu
520838ce65 V1.00.20: OTA_END ack guaranteed delivery via deferred reset
- app_ota.c: after END ok, wait until the RSP is consumed by the host
  (BLE e0005 read-out / UART TX done) plus 300ms grace before resetting,
  2s timeout fallback; polled from the BLE schedule task (rwip_schedule
  must keep running for the ATT read to be processed)
- main.c: app_ota_reset_poll() in the BLE schedule task loop
- docs: ble_protocol.md 6.6 note, dev log section 43, AGENTS.md sync
2026-09-04 17:35:01 +08:00
evan.liu
266fcec731 mcm-ddc-ble V1.00.18:发布命名整理(生产整包mothercup_ble_prod,OTA单文件发布件mothercup_ble_ota);合并OTA包头扩为52B(新增hdr_len/total_size/payload_crc,原json清单信息全部收进头部,单文件发布);merge_image.py新增--combo-name;ble_ota_update.py/ble_ota.bat PC端BLE OTA升级器(实验性:CUR_BANK选包/扇区擦除避让节流/复位检测,实机调通中);SWD单bank升级流程实测通过(bin\@基址部分烧录+bsset修记录+appsw切入);格式与升级流程写入ble_protocol.md §7供App/UART升级开发;开发日志40~41 2026-09-04 16:01:41 +08:00
evan.liu
a546dc5f46 mcm-ddc-ble V1.00.16~17:实测板载硅片为256KB(0x01040000起CPU读回绕/SWD fault),Flash布局回退256KB(Boot16K/bs8K/APP_DATA8K不变,APP1 0x01008000/112K,APP2 0x01024000/112K);新增appsw命令切换运行bank(记录校验+目标镜像CRC32复算防呆);uvprojx新增APP2 target(链接0x01024000,VTOR基址宏化,版本号可被target覆盖);新增make_dual_package.bat双APP整包脚本(merge_image.py支持--app2/--with-appdata);新增信息项0x07 CUR_BANK识别当前运行bank;OTA双bank配套:出包同时产bank1/bank2两份载荷(清单带target_bank),OTA_END校验镜像向量表Reset地址落在目标bank(新状态6 bank_mismatch);flash_package.bat改用DFP pack的n32wb031keq6_2 target+smart_flash=false;appsw双bank切换与CUR_BANK已实测通过;文档同步(开发日志37~39/ble_protocol.md/AGENTS.md) 2026-09-04 15:22:53 +08:00
evan.liu
4b4f20774d mcm-ddc-ble V1.00.14:引入cJSON v1.7.18到src/infra(分配经cJSON_InitHooks挂FreeRTOS pvPortMalloc,惰性初始化);参数接口层JSON化(appget json输出JSON对象,appset json {"led":500}入参,未知键忽略前向兼容,越界整体不生效,成功回显JSON);Flash存储层保持caiic_params_t二进制记录不动;uvprojx三target加infra组;文档同步(开发日志§34/ble_protocol.md §6.5/AGENTS.md);整包+OTA包已出到tools/out 2026-09-04 13:35:26 +08:00
evan.liu
d82b6217a4 mcm-ddc-ble V1.00.11~13:CLI新增reset/factory/uartrst/uartinfo四条维护命令(复位单板/恢复出厂设置/复位串口/查询串口参数);CLI读写特征应答改分包上报(缓冲512B->1024B+读游标,片长att_mtu-2恒短读避开Read Blob偏移不下发的栈限制,0长度包=应答结束);help恢复完整帮助表+help <cmd>单条查询;ble_cli_test.py与App McmCli.ts同步改循环读;文档同步(开发日志31~33/ble_protocol.md/AGENTS.md/App修改记录);整包+OTA包已出到tools/out 2026-09-04 11:29:28 +08:00
evan.liu
9c84bdb6cb mcm-ddc-ble V1.00.09:新增bootsetting与APP_DATA参数区结构化读写(仅命令访问,无裸读写防变砖);param命令管理caiic_params_t参数记录(led1_blink_ms即时生效于LED1闪烁/pwm_duty_pct仅存储),bsdump/bsset结构化读写bootsetting(自动重算CRC+擦除编程+读回校验);UART与BLE CLI读写特征双通道可用;AGENTS.md恢复为/init新版并同步;整包+OTA包已出到tools/out 2026-09-04 10:20:54 +08:00
evan.liu
2117c140fc mcm-ddc-ble V1.00.02~08:新增CLI读写特征(...c72e0003,写命令读应答)与只读参数特征(...c72e0004,全项TLV);修复温度开机首读垃圾值(ADC初始化预热+丢弃首转);blelog补写回调/CCCD订阅可见日志并修正CCCD值解析;tools新增bleak测试客户端(ble_cli_test.py/ble_cli.bat/ble_temp_watch.py);make_package.bat改指mcm-ddc-ble;merge_image.py自动取APP_FW_VERSION_NUM写入OTA清单;AGENTS.md记录固件版本递增约定;开发日志第28节 2026-09-04 08:52:44 +08:00
evan.liu
77ec340db2 ble_protocol.md新增手机端开发指南(连接初始化/CRC与组帧解帧参考实现/字节级示例表/时序与异常处理);merge_image.py出整包时同步产出OTA镜像(_ota.bin+_ota.json清单);文档目录移至仓库根docs/ 2026-09-03 06:31:48 +08:00