Skip to content

Commit 85e285e

Browse files
committed
platforms/blackpill-f4: Set different core clocks
* libopencm3 has presets for 84 & 96mhz, use them for f401 and f411 respectively. Same for DFU.
1 parent 5554b6e commit 85e285e

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

src/platforms/blackpill-f401cc/platform.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#ifndef PLATFORMS_BLACKPILL_F401CC_PLATFORM_H
2424
#define PLATFORMS_BLACKPILL_F401CC_PLATFORM_H
2525

26-
#define PLATFORM_IDENT "(BlackPill-F401CC) "
26+
#define PLATFORM_IDENT "(BlackPill-F401CC) "
27+
#define PLATFORM_CLOCK_FREQ RCC_CLOCK_3V3_84MHZ
2728

2829
#include "blackpill-f4.h"
2930

src/platforms/blackpill-f401ce/platform.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#ifndef PLATFORMS_BLACKPILL_F401CE_PLATFORM_H
2424
#define PLATFORMS_BLACKPILL_F401CE_PLATFORM_H
2525

26-
#define PLATFORM_IDENT "(BlackPill-F401CE) "
26+
#define PLATFORM_IDENT "(BlackPill-F401CE) "
27+
#define PLATFORM_CLOCK_FREQ RCC_CLOCK_3V3_84MHZ
2728

2829
#include "blackpill-f4.h"
2930

src/platforms/blackpill-f411ce/platform.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#ifndef PLATFORMS_BLACKPILL_F411CE_PLATFORM_H
2424
#define PLATFORMS_BLACKPILL_F411CE_PLATFORM_H
2525

26-
#define PLATFORM_IDENT "(BlackPill-F411CE) "
26+
#define PLATFORM_IDENT "(BlackPill-F411CE) "
27+
#define PLATFORM_CLOCK_FREQ RCC_CLOCK_3V3_96MHZ
2728

2829
#include "blackpill-f4.h"
2930

src/platforms/common/blackpill-f4/blackpill-f4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void platform_init(void)
6868
scb_reset_core();
6969
}
7070
#endif
71-
rcc_clock_setup_pll(&rcc_hse_25mhz_3v3[RCC_CLOCK_3V3_84MHZ]);
71+
rcc_clock_setup_pll(&rcc_hse_25mhz_3v3[PLATFORM_CLOCK_FREQ]);
7272

7373
/* Enable peripherals */
7474
rcc_periph_clock_enable(RCC_OTGFS);

src/platforms/common/blackpill-f4/usbdfu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main(void)
5050
dfu_jump_app_if_valid();
5151
}
5252

53-
rcc_clock_setup_pll(&rcc_hse_25mhz_3v3[RCC_CLOCK_3V3_84MHZ]);
53+
rcc_clock_setup_pll(&rcc_hse_25mhz_3v3[PLATFORM_CLOCK_FREQ]);
5454

5555
/* Assert blue LED as indicator we are in the bootloader */
5656
rcc_periph_clock_enable(RCC_GPIOC);

0 commit comments

Comments
 (0)