Overclocking STM32F103

What could be included in further releases, or for the forum.
User avatar
RogerClark
Posts: 6692
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Overclocking STM32F103

Post by RogerClark » Sun Sep 06, 2015 1:03 am

Thanks Victor

I should copy my changes for the GD32 into the STM32 as they will all be beneficial.

I had to add a function to set the prescaler function and the emums etc, as it was the only way that seemed to work ;-)

I should change the stuff to do with systick as well and use F_CPU - 1 as the preload value .... etc etc

User avatar
RogerClark
Posts: 6692
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Overclocking STM32F103

Post by RogerClark » Sun Sep 06, 2015 1:11 am

Victor

I've just realised, you may need to change the bootloader as well, as it will try to run at 72Mhz but may not be able to change its USB prescaler (though I'd give it a try first as the bootloader startup code is a lot different to the core, so it may be OK)

victor_pv
Posts: 1603
Joined: Mon Apr 27, 2015 12:12 pm

Re: Overclocking STM32F103

Post by victor_pv » Sun Sep 06, 2015 1:16 am

RogerClark wrote:Victor

I've just realised, you may need to change the bootloader as well, as it will try to run at 72Mhz but may not be able to change its USB prescaler (though I'd give it a try first as the bootloader startup code is a lot different to the core, so it may be OK)

The bootloader seems to work fine in every case, I guess because it only runs after a hardware reset and the usb clock must be disabled by the reset. If we did a software reset from a sketch it may fail, but I think its unlikely anyone would do that.

I copied your enum for the div speeds, but nothing for the systick.
Whenever you apply those changes to the STM I will resync, first give it a shot in the GD and confirm it works good for you.

User avatar
RogerClark
Posts: 6692
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Overclocking STM32F103

Post by RogerClark » Sun Sep 06, 2015 1:42 am

Victor

OK.

Send me the text changes to reset the USB prescaler stuff and I'll give it a try, as I already have it setup to run the GD32, but I can only test the various speeds if I use STLink

PS. I have quite a few changes to make sure everything works when you change F_CPU, there are some numbers associated the peripheral clocks e.g. e.g. 72000000 and 36000000 on the STM32 and the delay timing coefficient

Actually, I've not checked why the clock speed of the peripherals clocks is defined in the code at all. It seems a bit odd, but I thought it was safer to update everything.

But in hindsight, perhaps I should have checked if there were any referneces to APB1 and APB2 in the code, as its possible the perhipheral clock freq def's are redundant

BTW. In the GD32 I also removed from of the stm32f2 stuff as I knew it was completely redundant

So this is something I suspect I can do in the STM32 core as well.

victor_pv
Posts: 1603
Joined: Mon Apr 27, 2015 12:12 pm

Re: Overclocking STM32F103

Post by victor_pv » Sun Sep 06, 2015 1:54 am

RogerClark wrote:Victor

OK.

Send me the text changes to reset the USB prescaler stuff and I'll give it a try, as I already have it setup to run the GD32, but I can only test the various speeds if I use STLink
The changes are in my last post in page 3.
I did not touch anything else related to systick or other peripherals, just the USB.

User avatar
RogerClark
Posts: 6692
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Overclocking STM32F103

Post by RogerClark » Sun Sep 06, 2015 2:00 am

OK

I think you mean this post

http://www.stm32duino.com/viewtopic.php ... t=20#p5565

Thanks

User avatar
RogerClark
Posts: 6692
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Overclocking STM32F103

Post by RogerClark » Sun Sep 06, 2015 3:43 am

Victor

Thanks.

I've applied those changes to the GD32 core and they seem to work OK. i.e I can select the CPU speed from the menu and still upload via the bootloader.

I will probably change the bootloader so that its running at 96Mhz for the GD32, so that its within spec in case someone has a GD32 that won't run at 120Mhz

I'll try to update the STM32 stuff as well today.

Thanks

Roger

daybyter
Posts: 14
Joined: Fri Oct 09, 2015 1:40 am

Re: Overclocking STM32F103

Post by daybyter » Tue Nov 17, 2015 12:00 am

Is it correct, that I configure the PLL with

void rcc_configure_pll(rcc_pll_cfg *pll_cfg);

now in the latest stm32duino code?

So I need a object of type

typedef struct rcc_pll_cfg {
rcc_pllsrc pllsrc; /**< PLL source */

/** Series-specific configuration data. */
void *data;
} rcc_pll_cfg;

to set the pll multiplier? I there an example for the content of *data ?

TIA,
Andreas

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest