AnsweredAssumed Answered

STM3210C - Clock Frequency Irregularites

Question asked by corregedor.antonio on Apr 16, 2012
Latest reply on Apr 24, 2012 by corregedor.antonio
Hi all,

I am currently using the STM3210C evaluation board and have discovered something which is puzzling, and has to do with the clock frequencies.  I am currently using Atollic to program the board and have initialised the micro by using the "SystemInit()" function and have determined that the following clock frequencies have been set by calling the "RCC_GetClocksFreq()" function:
       
  • SYSCLK = 72 MHz
  •    
  • HCLK = 72 MHz
  •    
  • PCLK1 = 36 MHz
  •    
  • PCLK2 = 72 MHz
  •    
  • ADCCLK = 18 MHz
With the above frequencies I am able to determine for example, what preload values I require in order to generate an interrupt at a specific interval.  I first noticed that the clock frequencies were not as stated above when I configured the SysTick interrupt.  I configured SysTick by calling "SysTick_Config()" which sets the SysTick counter clock source to be the core clock source (HCLK). 

However with the use of an oscilloscope I discovered that sending a value of 172249 to the "SysTick_Config()" function produces an interrupt of 20 ms (50 Hz).  This means that the SysTick counter clock is set to 8.612450 MHz and not 72 MHz.  I even ensured that the SysTick counter clock was set to HCLK by calling "SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK )" after the "SysTick_Config(172249)" function.

I experienced the same behavior when setting up TIM2.  According to the data sheet the APB1 is clocked at the same frequency as PCLK1; which should be 36 MHz.  However upon doing similar testing I have discovered that the TIM2CLK is set to 8.61245 MHz.

Can anyone help me explain this behavior, or help me look for a command that could be possibly setting all the clocks to a frequency of 8.61245 MHz.  It sounds like they are in their default reset mode, but this does not make sense because when I call "RCC_GetClocksFreq()" it indicates that the clocks have been set accordingly. 

With the use of an oscilloscope I have tailored my code and have it working correctly but I would like to know why I am experiencing this behavior.  Thanks in advance for your help.

Kind Regards,
  Tony


Outcomes