2015-05-11 04:08 AM
Hi
I want to use the dSPIN family firmware library for my board. The STM32F107RC and a 8MHz crystal are integrated on my board. I have problem with this library (system clock configuration) and confused.
The SetSysClock() function is called at the main.c which configure the cystem clock frequency, HCLK, PCLK2 and PCLK1 prescalers.
I see this function (SetSysClock()) is defined at two different places in firmware library and called two times. One time in system_stm32f10x.c and another at Clock.c!!
I debugged my project by J-Link and I understood that from startup file (startup_stm32f10x_xx.s) before to branch to application main the SetSysClock() function is called through SystemInit () of system_stm32f10x.c and then return to main.c.
Again the application returns to startup file (line 160 of attached picture) and go to main.c. This time this function (SetSysClock()) is called directly from Clock.c. The defined function is different from defined function at system_stm32f10x.c.
I attached three files: main.c, Clock.c and system_stm32f10x.c.
So I correct the SetSysClock() to configure SetSysClockTo72() to have a system clock 72 MHz of my 8MHz. But in SetSysClock() calling of Clock.c, the system clock configuration is switched to SetSysClockTo24().
Should I change both of files (Clock.c and system_stm32f10x.c) according to my clock configuration?
Could you give me guidelines or solve my problem?
#dspin-family-firmware-library