2016-07-17 07:53 AM
I am trying to set HSI48 as my sysclock on STM32F0 Discovery, but by doing this I somehow ended up with an unexpected interrupt and stuck in an infinite loop.
I am using True Studio by the way. Not using CubeMX or peripheral lib, just old fashioned reg manipulating.Anyone had any luck at this? Or are we stuck with HSI 8MHz x 8 PLL to get 48MHz CPU clock? #hsi48-stm32f02016-07-17 09:38 AM
Not a part I'm actively using, but I would hazard you just need to get the register settings all correctly along the clocking paths, and with the flash wait states.
What interrupt? Stuck where? If you are in the Hard Fault handler, it is possible to do things more productive than while(1) loops. On the Cortex-Mx series if you fail to clear the source of an interrupt or fault it will keep coming back via the NVIC2016-07-18 05:36 AM
Hi,
It got stuck in Default_Handler. But the thing is that I made sure that the syclk switching is done only after all interrupts had been disabled, and only after the clock is ready.It might be a Hard Fault, but I can't figure out how a simple clock switching can result in these things. After all, the same code worked well if I am switching to the slower 8MHz HSI.I used only 8 bit micros all this while, and a little 16 bit micros. The complexity of the chip is quite overwhelming.2016-07-18 06:47 AM
The complexity of the chip is quite overwhelming.
Register level programming doesn't scale well. The FLASH array is speed sensitive. It will run fine at 8 MHz2016-07-18 10:19 AM
Hi chai.ck,
Ensure that you have applied the recommendation in the reference manual: ''The HSI48RDY flag in the Clock control register (RCC_CR) indicates if the HSI48 RC is stable or not. At startup, the HSI48 RC output clock is not released until this bit is set by hardware.
The HSI48 RC can be switched on and off using the HSI48ON bit in the Clock control register (RCC_CR). This oscillator will be also automatically enabled (by hardware forcing HSI48ON bit to one) as soon as it is chosen as a clock source for the USB and the peripheral is enabled.
'' -Hannibal-2016-07-30 12:38 AM
You're right. It ran fine after I set the flash latency setting in FLASH_ACR to 1