with the new version of ChibiOS (4.0.4) I found a difference about clock configuration.
In particular I'm thinking about the macro STM32_HSE_BYPASS and the behavior of crystal oscillator and cpu clock speed.
Because in the past, I've usually changed the settings in mcuconf.h, like
Code: Select all
#define STM32_NO_INIT FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED FALSE
#define STM32_CLOCK48_REQUIRED TRUE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 12
#define STM32_PLLN_VALUE 168
#define STM32_PLLP_VALUE 2 //168Mhz
#define STM32_PLLQ_VALUE 7
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_RTCPRE_VALUE 8
#define STM32_MCO1SEL STM32_MCO1SEL_HSI
#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
#define STM32_I2SSRC STM32_I2SSRC_CKIN // disable I2S PLL
#define STM32_SAISRC STM32_SAISRC_PLL // enable SAI PLL
#define STM32_PLLSAIN_VALUE 126 // x 2MHz = 252MHz
#define STM32_PLLSAIQ_VALUE 8 // PLLSAICLK, not used
#define STM32_PLLSAIR_VALUE 5 // PLLLCDCLK = fVCO/5 = 50.4MHz
#define STM32_PLLSAIR_POST STM32_SAIR_DIV2 // hw minimum = 25.2MHz
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_BKPRAM_ENABLE FALSE
and board.h
Code: Select all
#if !defined(STM32_HSECLK)
#define STM32_HSECLK 24000000U
#endif
/*
* Board voltages.
* Required for performance limits calculation.
*/
#define STM32_VDD 300U
but now from the default configuration of STM32F072-DISCOVERY I've got
Code: Select all
#define STM32_NO_INIT FALSE
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_HSI_ENABLED TRUE
#define STM32_HSI14_ENABLED TRUE
#define STM32_HSI48_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSI_DIV2
#define STM32_PREDIV_VALUE 1
#define STM32_PLLMUL_VALUE 12
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE STM32_PPRE_DIV1
#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
#define STM32_MCOPRE STM32_MCOPRE_DIV1
#define STM32_PLLNODIV STM32_PLLNODIV_DIV2
#define STM32_USBSW STM32_USBSW_HSI48
#define STM32_CECSW STM32_CECSW_HSI
#define STM32_I2C1SW STM32_I2C1SW_HSI
#define STM32_USART1SW STM32_USART1SW_PCLK
#define STM32_RTCSEL STM32_RTCSEL_LSI
and in board.h
Code: Select all
#if !defined(STM32_LSECLK)
#define STM32_LSECLK 0U
#endif
#define STM32_LSEDRV (3U << 3U)
#if !defined(STM32_HSECLK)
#define STM32_HSECLK 0U
#endif
#define STM32_HSE_BYPASS
Can I still use the old way to change the settings?
In particular I have a custom board based on STM32F072RB which I want to use with 12Mhz external oscillator and CPU speed of 48MHz, with ST's excel I've got the values in the image below.
Thanks