AnsweredAssumed Answered

Cannot flash STM32F103 if PLL enabled

Question asked by kolesnikov.ivan on Feb 26, 2016
Latest reply on Mar 4, 2016 by kolesnikov.ivan
I'm trying to deal with the setting clocking of STM32F103 MCU without the use of third-party libraries.
I wrote several functions for this: http://pastebin.com/kLQS9Umw
If I setup clocking by stm32_rccUseHSE, then everything works fine.
However, if I setup PLL using stm32_rccUsePLLFromHSE function, then there are problems.
The program is fully working correctly, the frequency changes to right, nothing is buggy and firmware does not hang. I can connect via SWD debugger and debug the program.
However, if I try to flash a microcontroller, the flashing utility hangs.
If I hold the reset button, then start the firmware flashing, and then quickly release the button, the flashing succeed. If I reboot into bootloader (BOOT0 = HIGH), then I can also fine to flash the controller (via UART or SWD).
This problem does not occur if I use libraries such as ChibiOS or libopencm3. I tried to find differences between them clocking setup code and my, but could not.
What could be the problem?

Outcomes