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

Commit d075c2b

Browse files
ALTracerALTracer
authored andcommitted
bluepillplus: Add chip detection of APM32F103
1 parent 4f592b7 commit d075c2b

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
@@ -162,6 +162,17 @@ static void platform_detect_variant(void)
162162
}
163163
}
164164

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

0 commit comments

Comments
 (0)