Overclocking STM32F103

What could be included in further releases, or for the forum.
madias
Posts: 812
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Overclocking STM32F103

Postby madias » Fri Jul 17, 2015 10:11 pm

*ROFL*
With this "building" into a marshall valve combo you wont have the "volume 11", but the "volume 13" at minimum :)
https://en.wikipedia.org/wiki/Up_to_eleven

User avatar
ahull
Posts: 1404
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Overclocking STM32F103

Postby ahull » Fri Jul 17, 2015 10:12 pm

You could of course also bolt on a fan :twisted:

Image
- Andy Hull -

User avatar
Rick Kimball
Posts: 728
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Overclocking STM32F103

Postby Rick Kimball » Thu Sep 03, 2015 10:35 pm

With all this GD32F103 speed daemon talk, I thought I'd try pushing my chips a little. I was surprised no one has mentioned how to output the clock to verify what speed you are running. You can output the PLL clock divided by 2 on PA8 if you use the following:

Code: Select all

  // configure PA8 to output PLL/2 clock
  gpio_set_mode(GPIOA, 8, GPIO_AF_OUTPUT_PP);
  *(volatile uint8_t *)(0x40021007) = 0x7 /*MCO_Config(PLL/2)*/;


I'm happily running at 96MHz with 1 wait state on a Red Pill. You do have to change some defines regarding systick and microsecond counting..

-rick
-rick

zmemw16
Posts: 983
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: Overclocking STM32F103

Postby zmemw16 » Thu Sep 03, 2015 10:38 pm

oh wizard, from whence did the 0x40021007 come?

stephen

User avatar
Rick Kimball
Posts: 728
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Overclocking STM32F103

Postby Rick Kimball » Thu Sep 03, 2015 10:58 pm

RCC_CFGR

look in the rm0008 reference manual bits 24:26
it was on page 98 I found the address in spl headers
-rick

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

Re: Overclocking STM32F103

Postby victor_pv » Thu Sep 03, 2015 11:07 pm

Rick Kimball wrote:RCC_CFGR

look in the rm0008 reference manual bits 24:26
it was on page 98 I found the address in spl headers


is the usb port still working?

User avatar
Rick Kimball
Posts: 728
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Overclocking STM32F103

Postby Rick Kimball » Thu Sep 03, 2015 11:09 pm

I wasn't worried about it , but I seriously doubt it. BTW 0 wait states locked it up
-rick

User avatar
mrburnette
Posts: 1769
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Overclocking STM32F103

Postby mrburnette » Thu Sep 03, 2015 11:12 pm

zmemw16 wrote:oh wizard, from whence did the 0x40021007 come?

stephen



Rick with his Black Magic Probe extended to contain the beastly over-clocked fire breathing dragon:

Image
Last edited by mrburnette on Fri Sep 04, 2015 12:13 pm, edited 1 time in total.

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

Re: Overclocking STM32F103

Postby RogerClark » Thu Sep 03, 2015 11:33 pm

Rick Kimball wrote:I You do have to change some defines regarding systick and microsecond counting..

-rick


I changed this, so that it automatically picks up F_CPU.

\Arduino_STM32\GD32F1\variants\generic_gd32f103c\board\board.h
Line 40: #define SYSTICK_RELOAD_VAL (F_CPU/1000) - 1 /* takes a cycle to reload */


I guess I should change it in the STM32 core as well.

There is also some stuff to do with delay() but its hard coded with #if's as I couldn't seem to get it to work using F_CPU (but I had bigger fish to fry at the time so should revisit it)


BTW> I also changed stm32.h

#if STM32_F1_LINE == STM32_F1_LINE_PERFORMANCE
# ifndef STM32_PCLK1
# define STM32_PCLK1 F_CPU/2
# endif
# ifndef STM32_PCLK2
# define STM32_PCLK2 F_CPU
# endif
# ifndef STM32_DELAY_US_MULT
#if F_CPU == 120000000
#define STM32_DELAY_US_MULT 40 /* FIXME: value is incorrect. */
#elif F_CPU == 96000000
#define STM32_DELAY_US_MULT 32 /* FIXME: value is incorrect. */
#elif F_CPU == 72000000
#define STM32_DELAY_US_MULT 24 /* FIXME: value is incorrect. */
#endif

So those values were correct for F_CPU if you change F_CPU

the ones marked FIXME (leaflabs old comments) set the delay loop values. I just extrapolated from the 24 that the 72Mhz STM32 uses.

It should have been possible to do something like F_CPU/72000000 * 24 to give the value, but I recall it not working.

Its probably easiest to look at the Diff's in github for the 2 or 3 commits I did for the GD32, as there are quite a few changes to make F_CPU selectable

BTW. I think I maxed out my Red Pill, ie set the PLL to 16 x and it still ran OK !


AND...

I guess ideally the crystal freq could be defined in the code, so the PLL value could be determined based on the F_CPU value from boards.txt

And. Look in the GD32, I have a menu to select F_CPU

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

Re: Overclocking STM32F103

Postby RogerClark » Thu Sep 03, 2015 11:54 pm

Update
This works


#define STM32_DELAY_US_MULT (F_CPU / 3000000)


Sorry. I don't think it works, but there must be a way to get something like this to work


Return to “Ideas & suggestions”

Who is online

Users browsing this forum: No registered users and 2 guests