cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F107 TIMERs

edxxgardo
Associate II
Posted on September 23, 2011 at 11:35

Hello again,

This time with a problem in setting the times.

I have a simple application that after the main call the SystemInit() function which set all the timers. This function is inside the system_stm32f10x.c file. Look at the code inside, I see:

#define SYSCLK_FREQ_72MHz  72000000

#elif defined SYSCLK_FREQ_72MHz

 const uint32_t SystemFrequency         = SYSCLK_FREQ_72MHz;      /*!< System Clock Frequency (Core Clock) */

  const uint32_t SystemFrequency_SysClk  = SYSCLK_FREQ_72MHz;      /*!< System clock                        */

  const uint32_t SystemFrequency_AHBClk  = SYSCLK_FREQ_72MHz;      /*!< AHB System bus speed                */

  const uint32_t SystemFrequency_APB1Clk = (SYSCLK_FREQ_72MHz/2);  /*!< APB Peripheral bus 1 (low)  speed   */

  const uint32_t SystemFrequency_APB2Clk = SYSCLK_FREQ_72MHz;      /*!< APB Peripheral bus 2 (high) speed   */

and finally, the call to the SetSysClockTo72() function at the bottom of the file. In summary, after calling this function, the system clock should be set to 72MHz.

If I call RCC_GetClocksFreq(&RCC_Clocks) just after callingSystemInit() and I use the debugger, I can see this numbers:

SYSCLK_Frequency=4182367265

HCLK_Frequency=2124520693

PCLK1_Frequency=1051260827

The question is: shouldn't I see SYSCLK_Frequency equal to 72000000 or similar? and why these numbers in term s of billions and millions, as maximum 72?

thanks for any help.

1 REPLY 1
drzile86
Associate II
Posted on September 23, 2011 at 16:04

Hi Pablo,

I have used STM3210C eval board and I have downloaded

demonstration firmware

code for this eval -IOExpander. At the beginning of code, they have called functionSystemInit(); from system_stm32f10x.c file. After this function, I have called functionRCC_GetClocksFreq(&RCC_Clocks); fromstm32f10x_rcc.c file. Before that I have defined RCC_Clocks strucure as RCC_ClocksTypeDef RCC_Clocks;. When I have looked with ST link

debugger, everything seems fine to me, as you can see at attached picture.

Regards,

Dragan

________________

Attachments :

rcc_clocks.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0kY&d=%2Fa%2F0X0000000beZ%2FygTr4ElAyzH_rqXQZHwnZCxRfk4VvzyVsnu3nZ3tzIU&asPdf=false