AnsweredAssumed Answered

Bugs/Errors on Cube for F1 - Sysclock crashes on Examples

Question asked by Oliver W. on Apr 27, 2015
Hey together,

I'm new on STM32 Architecture (coming from *** ol' AVR8) and got started with a Nucleo STM32F103RB. First steps using mbed online compiler worked so i started setting up my environment.

I'm developing in Eclipse using the System Workbench Plugins and Downloaded the Cube Package by Hand from st.com.
Cube Package: STM32Cube_FW_F1_V1.0.0.zip

I started with the GPIO_IOToggle example from the packade, but it didn't work. 
After checking my toolchain 100 times, while debugging i noticed it crashed at
main() -> SystemClock_Config() -> SystemClock_Config()  after the line
"MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_ClkInitStruct->SYSCLKSource);"
(OFF TOPIC: isn't there a code tag here?)

Now that uses the Define RCC_CFGR_PLLMULL16 from stm32f103xb.h, line 966:
#define  RCC_CFGR_PLLMULL16                 ((uint32_t)0x00380000)        /*!< PLL input clock*16 */

Given the Reference Manual RM0008, Chapter 7.3.2, this is correct. But the µC crashes on setting the clock. So i tried to use HSI as Clock -> worked.
After that i tried to use a lower PLL Multi, and PLL_MULL_8 works like a charm.

Which gives me some questions:
-Obvious: Why does it not work?
-little strange for me:
The Program calls HAL_Init before setting the clock.
On HAL_Init it configures the interrupt to HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

But at that point the Controller runs on HSI which is 8MHz, after clock change it runs on HSI / 2 * 8 = 32Mhz.
But my Interrupt / my HAL_Delay works fine. Why isn't it 4 times faster than expected?

Im sorry if I may sound confused, I am ;)

Thanks for your help, Olli

Outcomes