I have a custom design that uses the STM32F072 and an 8MHz crystal.
I want to ensure I'm using that crystal and not the internal clock. Below is what seems to be the relevant sections of the mcuconf.h and board.h configuration files- they're un-modified from the original example. While my project does indeed run, it seems it's configured to use the internal 8MHz clock. Related, I'm trying to determine the proper peripheral speed for CAN, and when I calculate the baud rate prescalers and other parameters, I'm not getting the expected CAN baud rate for a 48MHz bus, which led me to ensure I'm properly using my external 8MHz crystal.
I've tried to comment out STM32_HSE_BYPASS, set STM32_HSE_ENABLED to TRUE, set STM32_HSI_ENABLED to FALSE, and set STM32_HSECLK to 8000000U .
When I compile the project I get the following error:
Code: Select all
In file included from ./ChibiOS//os/hal/include/hal.h:32:0,
from ./ChibiOS//os/hal/src/hal.c:25:
./ChibiOS//os/hal/ports/STM32/STM32F0xx/hal_lld.h:486:2: error: #error "HSI not enabled, required by STM32_CECSW"
./ChibiOS//os/hal/ports/STM32/STM32F0xx/hal_lld.h:490:2: error: #error "HSI not enabled, required by STM32_I2C1SW"
./ChibiOS//os/hal/ports/STM32/STM32F0xx/hal_lld.h:500:2: error: #error "HSI not enabled, required by STM32_SW and STM32_PLLSRC"
make: *** [build/obj/hal.o] Error 1
What combination of settings should I use for an external 8MHz crystal?
Thank you for any help!
mcuconf.h
Code: Select all
#define STM32F0xx_MCUCONF
/*
* HAL driver system settings.
*/
#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
board.h
Code: Select all
/*
* Board oscillators-related settings.
* NOTE: LSE not fitted.
* NOTE: HSE not fitted.
*/
#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