Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 5f6e142

Browse files
committed
bluepillplus: Add chip detection of APM32F103
1 parent b84edbf commit 5f6e142

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/platforms/bluepillplus/platform.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ static void platform_detect_variant(void)
159159
}
160160
}
161161

162+
if (device_id == 0x410 && cpu_id == 0xc230 && SCB_CPUID == 0x412fc231U) {
163+
/* APM32F103CB: 0x410 (Medium Density), 0x412fc231 (Cortex-M3 r2p1) */
164+
if (romtable_cidr == 0xb105100dU && romtable_pidr == 0x04000bb4c3ULL) {
165+
/* APM32F103: Manufacturer 43b Partno 4c3 (PIDR = 0x04000bb4c3) */
166+
clock = &rcc_hse_config_hse8_96mhz;
167+
rcc_periph_clock_disable(RCC_USB);
168+
/* Set 96/2=48MHz USB divisor before enabling PLL */
169+
rcc_set_usbpre_gd32f30x(RCC_CFGR_USBPRE_PLL_CLK_DIV2);
170+
}
171+
}
172+
162173
if (device_id == 0x410 && cpu_id == 0xc230 && SCB_CPUID == 0x412fc231U) {
163174
/* GD32F103CB: 0x410 (Medium Density), 0x412fc231 (Cortex-M3 r2p1) */
164175
if (romtable_cidr == 0xb105100dU && romtable_pidr == 0x07000d1f64ULL) {

0 commit comments

Comments
 (0)