修复 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
This commit is contained in:
evan.liu 2026-09-13 09:31:22 +08:00
parent c9c1d474a7
commit a4442c14a5
15 changed files with 5694 additions and 5652 deletions

View File

@ -1560,3 +1560,20 @@ APP2 链接的镜像发向 APP1 区。设备端 END 校验(向量表 Reset PC
- help 串更新为 `dispset <pin1-7|all> [0|1|z]`。
- 版本:APP `V1.00.33` → `V1.00.34`(`APP_FW_VERSION_NUM` 0x00010021 →
0x00010022)。Boot 不动(仍 V1.00.07)。
## 63. 修复 PA0/PA1(数码管 pin3/pin4)拉高无输出:GPIOA 时钟未使能(2026-09-06,APP V1.00.35,仅 APP)
- 现象:`dispset pin3 1`(PA0)/ `dispset pin4 1`(PA1)拉高后管脚无输出;
GPIOB 侧的 pin1/pin2 等正常。
- 根因:§58 数码管驱动把原 `LedInit(LED1/LED2)` 从 `main.c` 删除后,
**GPIOA 时钟(`RCC_APB2_PERIPH_GPIOA`)再无人使能**——原 `app_gpio.c`
`LedInit()` 里那两行 `RCC_EnableAPB2PeriphClk(GPIOA/GPIOB)` 是唯一使能点。
GPIOB 因 `bsp_usart.c`(USART1 PB6/PB7)仍会使能,故只有 GPIOA 的
PA0/PA1/PA6 失效。`GPIO_InitPeripheral`/`GPIO_SetBits` 对时钟未开的端口
写寄存器无效,管脚不动作(模式本身 `GPIO_MODE_OUTPUT_PP` 是对的)。
- 修复:
- `app_display.c` `display_task` 开头显式使能 GPIOA + GPIOB 时钟;
- `cli_core.c` `cli_disp_set_pin()` 里按端口再使能一次(防御,独立于
display_task 也能用)。
- 版本:APP `V1.00.34` → `V1.00.35`(`APP_FW_VERSION_NUM` 0x00010022 →
0x00010023)。Boot 不动(仍 V1.00.07)。

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,12 @@
#define __APP_VERSION_H__
#ifndef APP_FW_VERSION
#define APP_FW_VERSION "V1.00.34"
#define APP_FW_VERSION "V1.00.35"
#endif
/* Numeric form used by the BLE info query / OTA records: 0x00MMmmpp */
#ifndef APP_FW_VERSION_NUM
#define APP_FW_VERSION_NUM 0x00010022u
#define APP_FW_VERSION_NUM 0x00010023u
#endif
#endif /* __APP_VERSION_H__ */

View File

@ -376,6 +376,12 @@ void display_task(void *pvParameters)
(void)pvParameters;
/* The display spans GPIOA (PA0/PA1/PA6) and GPIOB (PB0/PB1/PB11/PB13);
* the app no longer calls LedInit (which used to enable these clocks),
* so turn both on here - otherwise the port-A pins never drive. */
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA, ENABLE);
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB, ENABLE);
all_pins_input();
for (;;)

View File

@ -715,6 +715,17 @@ static int cli_disp_set_pin(uint8_t pin_no, char val)
return -1;
}
/* Make sure the port clock is on before touching the pin (defensive;
* display_task also enables both clocks at boot). */
if (port == GPIOA)
{
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA, ENABLE);
}
else
{
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB, ENABLE);
}
GPIO_InitStruct(&s);
s.Pin = pin;
if (val == '1')

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,7 +1,7 @@
{
"file": "mothercup_ble_prod_ota.bin",
"target_bank": 1,
"size": 59392,
"crc32": "0x59E51401",
"version": 65570
"size": 59452,
"crc32": "0xA1AA2FDD",
"version": 65571
}

View File

@ -1,7 +1,7 @@
{
"file": "mothercup_ble_prod_ota_app2.bin",
"target_bank": 2,
"size": 59692,
"crc32": "0xB370E0B5",
"version": 65570
"size": 59756,
"crc32": "0xB12312FE",
"version": 65571
}