From e9c01dea3270da151b141201aa415b583cb5e583 Mon Sep 17 00:00:00 2001 From: mux Date: Tue, 21 Jan 2014 14:40:05 +0200 Subject: [PATCH 1/2] Remove hardcoded PLL_M value --- stm/system_stm32f4xx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stm/system_stm32f4xx.c b/stm/system_stm32f4xx.c index 8568a9b4f1..12ac4d6b56 100644 --- a/stm/system_stm32f4xx.c +++ b/stm/system_stm32f4xx.c @@ -54,9 +54,9 @@ *----------------------------------------------------------------------------- * APB2 Prescaler | 2 *----------------------------------------------------------------------------- - * HSE Frequency(Hz) | 8000000 changed dpgeorge + * HSE Frequency(Hz) | HSE_VALUE *----------------------------------------------------------------------------- - * PLL_M | 8 changed dpgeorge + * PLL_M | (HSE_VALUE/1000000) *----------------------------------------------------------------------------- * PLL_N | 336 *----------------------------------------------------------------------------- @@ -251,7 +251,7 @@ /************************* PLL Parameters *************************************/ /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ -#define PLL_M 8 +#define PLL_M (HSE_VALUE/1000000) /* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */ #define PLL_Q 7 From 4578ced20916c67c9c76124316d8c3faba3642bf Mon Sep 17 00:00:00 2001 From: mux Date: Tue, 21 Jan 2014 15:57:01 +0200 Subject: [PATCH 2/2] Add OSC_VALUE to Makefile * Add the option to pass OSC frequency on command line. --- stm/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stm/Makefile b/stm/Makefile index 3ea1472dc6..f55a9386c6 100644 --- a/stm/Makefile +++ b/stm/Makefile @@ -15,6 +15,7 @@ FATFSSRC=fatfs CC3KSRC=cc3k DFU=../tools/dfu.py TARGET=PYBOARD +OSC_VALUE=8000000 AS = arm-none-eabi-as CC = arm-none-eabi-gcc @@ -22,7 +23,7 @@ LD = arm-none-eabi-ld OBJCOPY = arm-none-eabi-objcopy SIZE = arm-none-eabi-size -CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -DSTM32F40_41xxx -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 +CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -DSTM32F40_41xxx -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=$(OSC_VALUE) CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(CMSIS) -I$(STMSRC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) -D$(TARGET) #CFLAGS += -I$(STMOTGSRC) -DUSE_HOST_MODE -DUSE_OTG_MODE