2011-03-31 06:04 PM
RCC_GetClocksFreq incorrect values with 14.7456MHz HSE?
2011-05-17 05:30 AM
Which part, and settings are you using the would provide for a 71.8848MHz clock from a 14.7456MHz input clock?
I could see 73.2380 or 66.3552 MHz2011-05-17 05:30 AM
Oops I should have mentioned the part. It is an STM32F105R8.
The settings are (I think...) straight from the datasheet (table 61, pg 90). PREDIV2 = 4 PLL2MUL = 12 PREDIV4 PLLMUL = 6.5 So if my math is right: (14.7456 / 4) * 12 = 44.2368 (44.2368 / 4) * 6.5 = 71.88482011-05-17 05:30 AM
Ok, it looks to be using more conventional PLL settings, rather than CL series ones.
I'll assume you have STM32F10X_CL defined in your project. May be this thread is related, I might take a look at generating a shell project with the parameters you describe and see what it creates with the library. There are bugs/quirks in a lot of this stuff, and sometimes you have to dig around a bit in the code/documentation to get it right. https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fClock%20setup%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E...2011-05-17 05:30 AM
Yes, I do have STM32F10X_CL defined.
I took a look at the sourcecode for the function yesterday and noticed a bunch of #ifdefs and special treatment for CL devices, even specific things about the 6.5x multiplier, so I just assumed it was properly supported, but this looks to be the problem: stm32f10x_rcc.c:970pllmull = 13 / 2; pllmull is an integer type, so this is truncating to 6.0, resulting in the low return values. As a fix, I left-shifted all pllmull sets by 1 and removed the /2, then right shifted all the results. I get the correct results at my clock settings now (and the serial port works), though obviously not tested with any other settings. If you're using the 6.5x multiplier available on a CL device you'll need this (a) fix, but for all other settings and devices I think the default code should work fine. A bug.2011-06-17 09:25 AM
Hi,
it seems I have the problem like you, because today I've tried with clock settings for a 14,7456MHz crystal but USART and timers are not correct. I'm working with STM32F105, and settings of /4 x12 and /4 x6.5. Can you post your correction of the stm32f10x_rcc.c? By the way for me it's not possible to read some older threads. Regards Achim2011-06-17 12:00 PM
By the way for me it's not possible to read some older threads.
Here's a cite from the ''new'' Fantastic Forumhttps://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Clock setup problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=364