I changed the clock section I copied from an example to:
Code: Select all
#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
#undef STM32_HSECLK
#undef STM32_HSE_BYPASS
#define STM32_HSECLK 8000000U
#if STM32_HSE_ENABLED == TRUE
#define STM32_PLLSRC STM32_PLLSRC_HSE
#else
#define STM32_PLLSRC STM32_PLLSRC_HSI_DIV2
#endif
#define STM32_PREDIV_VALUE 1
#define STM32_PLLMUL_VALUE 6
The #if HSE_ENABLED allows me to switch between HSE and non-HSE by only changing just the HSE-enabled define.
I just realized that I changed the multiplier from 12 to 6, so I should be running at 24MHz, now, instead of originally at 48. Still everything seems to work just fine. Not 2 seconds (real time)/second (on the clock).
Anyway, when I use HSE, the CPU goes "unhandled exception" after a few hundred miliseconds (but before the first second-rollover).
Code: Select all
(gdb) where
#0 _unhandled_exception ()
at chibios/os/common/startup/ARMCMx/compilers/GCC/vectors.c:46
#1 <signal handler called>
#2 0x55555554 in ?? ()
Any suggestions as to what I might be doing wrong?
[edit/update:] The milisecond timer is at 901 miliseconds when the crash happens. 5 times in a row.