cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in setting the clock of my device .

samiassaad
Associate II
Posted on March 17, 2011 at 13:40

Problem in setting the clock of my device .

18 REPLIES 18
samiassaad
Associate II
Posted on May 17, 2011 at 14:28

 I will try this tomorrow , right now I am out the office,

for editting that directly I think it is locked and not allowed to be edited.

Thank you Clive I will tell you the results tomorrow.

Posted on May 17, 2011 at 14:28

You will need to look through Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c

Check the SetSysClockTo72() routine. This seems to have some hard coded expectations of a 25 MHz source clock.

Perhaps step your way through it in the debugger.

Look at the RCC->CFGR2, RCC->CFGR, RCC->CR

PREDIV1 PLL

PREDIV2 PLL2

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
samiassaad
Associate II
Posted on May 17, 2011 at 14:28

No way , still the same , I start to think that here is bug in the newlib either in system tick configuration or clock config,

is there other way to access the regisered directly and set HSE and mul 9

and same for system tick  ?

samiassaad
Associate II
Posted on May 17, 2011 at 14:28

Thank you Clive ,

Anyone from ST team to check this issue ?

How to contact the ST support directly like that the case in microchip or TI?

Posted on May 17, 2011 at 14:28

I think the assumption is that if your hardware design differs from the reference designs, you need to read the reference manual, and modify the library to suit your needs. The library source is provided as a starting point, so you can actually modify it.

You need to look at the RCC registers, compare their current settings to those described in the reference manuals, and do the math on the settings vs the input clocks.

I'm not using the CL devices, but I don't think it would take long to look at the clock tree diagram, and program the PLL(s) to the appropriate values for your hardware. We're talking about modifying perhaps 5-6 lines of code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
samiassaad
Associate II
Posted on May 17, 2011 at 14:28

Thank you again , but is there away to modify the library since it is locked ?

samiassaad
Associate II
Posted on May 17, 2011 at 14:28

How did you calculate 23.04 MHz ,Clive ?

Thank you

Posted on May 17, 2011 at 14:28

How did you calculate 23.04 MHz

I scaled the clocks, based on the oscillator the code thinks it's using (25 MHz), against the one you are actually providing (8 MHz). And the PLL setting to get 72 MHz.

(72 / 25) * 8 = 23.04 ; How fast the PLL/CPU run with the wrong clock

25 / 8 = 3.125 ; How many times slower is your system/crystal

72 / 3.125 = 23.04

Thank you again , but is there away to modify the library since it is locked ?

If your files are marked READ ONLY, go change the properties of the Files/Folders

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
samiassaad
Associate II
Posted on May 17, 2011 at 14:28

Finally I could set my clock to 72MHz , after I could not mannage ST library to work with 8MHZ , I loaded the registers directly , and it is ok now .

Thank you Clive and thank everyone in this forum ; this my first time with STM32 , so I will be back with other problems . ;)