Optimisation and clock speed menu - enhancements

Information on the latest releases
edogaldo
Posts: 291
Joined: Fri Jun 03, 2016 8:19 am

Re: Optimisation and clock speed menu - enhancements

Post by edogaldo » Thu Oct 12, 2017 10:04 am

RogerClark wrote:
Mon Jul 31, 2017 3:11 am
BTW. I've updated the repo so there is a much bigger warning in upper case which reads

Overclocked 128Mhz NO USB SERIAL. MANUAL RESET NEEDED TO UPLOAD
Hi Roger, if you are adding unsupported options (i.e. 128MHz overclock) then I'd suggest also "HSI@48MHz with USB", not officially supported but seems working and could be useful for people having issues with HSE..
Here a sample on how to implement it: http://stm32duino.com/viewtopic.php?f=58&t=2676

Best, E.

[edit]This mode could be even more useful in the Maple bootloader.

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

Re: Optimisation and clock speed menu - enhancements

Post by RogerClark » Thu Oct 12, 2017 8:29 pm

Thanks.

Can you explain when this would be used ?

Is it for people who want to build their own board without the High Speed External crystal ( normally 8 Mhz) ?

edogaldo
Posts: 291
Joined: Fri Jun 03, 2016 8:19 am

Re: Optimisation and clock speed menu - enhancements

Post by edogaldo » Thu Oct 12, 2017 9:33 pm

It could be useful to provide usb features (ie dfu or serial usb) to custom boards missing the HSE or for boards with defective HSE.

alexandros
Posts: 76
Joined: Mon Oct 02, 2017 6:51 pm

Re: Optimisation and clock speed menu - enhancements

Post by alexandros » Tue Feb 20, 2018 1:24 pm

Hi Guys.

i want to add 96MHZ option in arduino IDE.just for test purposes
if i go to Boards.txt and add this red line into this section


#-- CPU Clock frequency
genericSTM32F103C.menu.cpu_speed.speed_96mhz=96Mhz (My Speed)
genericSTM32F103C.menu.cpu_speed.speed_96mhz.build.f_cpu=96000000L

genericSTM32F103T.menu.cpu_speed.speed_72mhz=72Mhz (Normal)
genericSTM32F103T.menu.cpu_speed.speed_72mhz.build.f_cpu=72000000L

genericSTM32F103T.menu.cpu_speed.speed_48mhz=48Mhz (Slow - with USB)
genericSTM32F103T.menu.cpu_speed.speed_48mhz.build.f_cpu=48000000L

genericSTM32F103T.menu.cpu_speed.speed_128mhz=Overclocked 128Mhz NO USB SERIAL. MANUAL RESET NEEDED TO UPLOAD
genericSTM32F103T.menu.cpu_speed.speed_128mhz.build.f_cpu=128000000L


So if i choose 96MHZ and just compile the sketch i am getting the following error ,

C:\Program Files (x86)\Arduino\hardware\Arduino_STM32-master\STM32F1\variants\generic_stm32f103c\wirish\boards_setup.cpp:63:49: error: 'BOARD_RCC_PLLMUL' was not declared in this scope

static stm32f1_rcc_pll_data pll_data = {BOARD_RCC_PLLMUL};



its obviously that something is missing , can somebody help me how to solve this?

stevestrong
Posts: 2067
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Optimisation and clock speed menu - enhancements

Post by stevestrong » Tue Feb 20, 2018 2:16 pm

Insert to https://github.com/rogerclarkmelbourne/ ... up.cpp#L53 following piece of code:

Code: Select all

#elif F_CPU==96000000
		#define BOARD_RCC_PLLMUL RCC_PLLMUL_12

alexandros
Posts: 76
Joined: Mon Oct 02, 2017 6:51 pm

Re: Optimisation and clock speed menu - enhancements

Post by alexandros » Tue Feb 20, 2018 2:26 pm

It works Thank you ,
I wonder if i can change from 72 to 96 and vice versa on runtime

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

Re: Optimisation and clock speed menu - enhancements

Post by RogerClark » Wed Feb 21, 2018 11:09 am

I think to change speed at runtime would require some changes to the code to make F-CPU a variable, because I think at the moment it’s effectively a constant or. Define

Btw. I presume you know USB only works at 72 and 48 because of a limitation in the USB PLL divider setting register ( it’s just 1 bit in a register to select for 72 or 48 MHz Main clock)

alexandros
Posts: 76
Joined: Mon Oct 02, 2017 6:51 pm

Re: Optimisation and clock speed menu - enhancements

Post by alexandros » Wed Feb 21, 2018 11:13 am

RogerClark wrote:
Wed Feb 21, 2018 11:09 am
Btw. I presume you know USB only works at 72 and 48 because of a limitation in the USB PLL divider setting register ( it’s just 1 bit in a register to select for 72 or 48 MHz Main clock)
i do, thats why i want to change it on the fly

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

Re: Optimisation and clock speed menu - enhancements

Post by mrburnette » Wed Feb 21, 2018 1:16 pm

alexandros wrote:
Wed Feb 21, 2018 11:13 am
...
i do, thats why i want to change it on the fly
Then try it and report back. Jawing about some hypothetical this or that simply does not derive an answer; research and test. I did 2 minutes with Google this morning and found this statement on the ST website (not an exact match to the uC we are using in Maple Mini, blue, etc)
https://community.st.com/thread/26730
Clive One
Feb 10, 2015 5:32 PM
Are there any caveats on runtime changing the prescalers?

Well they are designed not to glitch, but all peripheral clocking from them will need to have their own dividers adjusted to maintain the same rates, obviously.
See also: https://electronics.stackexchange.com/q ... sh-latency

I have spent 47 years working with computers in one capacity or another. There are countless things one can do with a machine that are not officially sanctioned, but will work ... or work well enough for a specific need. Experimentation is often required. If it works, come back and crow about it in the forum.


Ray

alexandros
Posts: 76
Joined: Mon Oct 02, 2017 6:51 pm

Re: Optimisation and clock speed menu - enhancements

Post by alexandros » Wed Feb 21, 2018 2:21 pm

mrburnette wrote:
Wed Feb 21, 2018 1:16 pm

Then try it and report back. Jawing about some hypothetical this or that simply does not derive an answer; research and test. I did 2 minutes with Google this morning and found this statement on the ST website (not an exact match to the uC we are using in Maple Mini, blue, etc)
https://community.st.com/thread/26730

Ray
Thanks for the link Ray , To be Honest , i have no idea what they talking about :lol:
anyway i will figure out something thanks again

Post Reply