File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020#define MICROPY_HW_ENABLE_SPI3 (1)
2121#define MICROPY_HW_ENABLE_CAN (1)
2222
23+ // HSE is 12MHz
24+ #define MICROPY_HW_CLK_PLLM (12)
25+ #define MICROPY_HW_CLK_PLLN (336)
26+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
27+ #define MICROPY_HW_CLK_PLLQ (7)
28+
2329// The Cerb40 has No LEDs
2430
2531// The Cerb40 has No SDCard
Original file line number Diff line number Diff line change 1919#define MICROPY_HW_ENABLE_SPI3 (1)
2020#define MICROPY_HW_ENABLE_CAN (0)
2121
22+ // HSE is 8MHz
23+ #define MICROPY_HW_CLK_PLLM (8)
24+ #define MICROPY_HW_CLK_PLLN (336)
25+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
26+ #define MICROPY_HW_CLK_PLLQ (7)
27+
2228// USRSW/UBTN (Needs Jumper UBTN) is pulled low. Pressing the button makes the input go high.
2329#define MICROPY_HW_USRSW_PIN (pin_A0)
2430#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
Original file line number Diff line number Diff line change 2323#define MICROPY_HW_ENABLE_SPI3 (0)
2424#define MICROPY_HW_ENABLE_CAN (0)
2525
26+ // HSE is 25MHz
27+ #define MICROPY_HW_CLK_PLLM (25)
28+ #define MICROPY_HW_CLK_PLLN (336)
29+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
30+ #define MICROPY_HW_CLK_PLLQ (7)
31+
2632// USRSW is pulled low. Pressing the button makes the input go high.
2733#define MICROPY_HW_USRSW_PIN (pin_B11)
2834#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
Original file line number Diff line number Diff line change 2020#define MICROPY_HW_ENABLE_SPI3 (0)
2121#define MICROPY_HW_ENABLE_CAN (1)
2222
23+ // HSE is 8MHz
24+ #define MICROPY_HW_CLK_PLLM (8)
25+ #define MICROPY_HW_CLK_PLLN (336)
26+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
27+ #define MICROPY_HW_CLK_PLLQ (7)
28+
2329// The pyboard has a 32kHz crystal for the RTC
2430#define MICROPY_HW_RTC_USE_LSE (1)
2531
Original file line number Diff line number Diff line change 1919#define MICROPY_HW_ENABLE_SPI3 (0)
2020#define MICROPY_HW_ENABLE_CAN (1)
2121
22+ // HSE is 8MHz
23+ #define MICROPY_HW_CLK_PLLM (8)
24+ #define MICROPY_HW_CLK_PLLN (336)
25+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
26+ #define MICROPY_HW_CLK_PLLQ (7)
27+
2228// The pyboard has a 32kHz crystal for the RTC
2329#define MICROPY_HW_RTC_USE_LSE (1)
2430
Original file line number Diff line number Diff line change 1919#define MICROPY_HW_ENABLE_SPI3 (0)
2020#define MICROPY_HW_ENABLE_CAN (1)
2121
22+ // HSE is 8MHz
23+ #define MICROPY_HW_CLK_PLLM (8)
24+ #define MICROPY_HW_CLK_PLLN (336)
25+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
26+ #define MICROPY_HW_CLK_PLLQ (7)
27+
2228// The pyboard has a 32kHz crystal for the RTC
2329#define MICROPY_HW_RTC_USE_LSE (1)
2430
Original file line number Diff line number Diff line change 1919#define MICROPY_HW_ENABLE_SPI3 (0)
2020#define MICROPY_HW_ENABLE_CAN (1)
2121
22+ // HSE is 8MHz
23+ #define MICROPY_HW_CLK_PLLM (8)
24+ #define MICROPY_HW_CLK_PLLN (336)
25+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
26+ #define MICROPY_HW_CLK_PLLQ (7)
27+
2228// USRSW is pulled low. Pressing the button makes the input go high.
2329#define MICROPY_HW_USRSW_PIN (pin_A0)
2430#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
Original file line number Diff line number Diff line change 9191 * @{
9292 */
9393
94+ #include "mpconfigboard.h"
9495#include "stm32f4xx_hal.h"
9596
9697void __fatal_error (const char * msg );
@@ -365,10 +366,10 @@ void SystemClock_Config(void)
365366 RCC_OscInitStruct .HSEState = RCC_HSE_ON ;
366367 RCC_OscInitStruct .PLL .PLLState = RCC_PLL_ON ;
367368 RCC_OscInitStruct .PLL .PLLSource = RCC_PLLSOURCE_HSE ;
368- RCC_OscInitStruct .PLL .PLLM = HSE_VALUE / 1000000 ;
369- RCC_OscInitStruct .PLL .PLLN = 336 ;
370- RCC_OscInitStruct .PLL .PLLP = RCC_PLLP_DIV2 ;
371- RCC_OscInitStruct .PLL .PLLQ = 7 ;
369+ RCC_OscInitStruct .PLL .PLLM = MICROPY_HW_CLK_PLLM ;
370+ RCC_OscInitStruct .PLL .PLLN = MICROPY_HW_CLK_PLLN ;
371+ RCC_OscInitStruct .PLL .PLLP = MICROPY_HW_CLK_PLLP ;
372+ RCC_OscInitStruct .PLL .PLLQ = MICROPY_HW_CLK_PLLQ ;
372373 if (HAL_RCC_OscConfig (& RCC_OscInitStruct ) != HAL_OK )
373374 {
374375 __fatal_error ("HAL_RCC_OscConfig" );
You can’t perform that action at this time.
0 commit comments