cancel
Showing results for 
Search instead for 
Did you mean: 

improving progam executiion speed

KumarTP
Associate II

To improve the execution time of a program being run on the board 'Nucleo-439ZI' from the current 20 ms period to less than 1 ms [more than 20 times reduction]. To reduce the same, I tried to switch the clock frequency source of the timer to HSE (8 MHz) instead of the internal clock (32.768KHz) [That means 24 times higher frequency to improve system latency ]. However, some issues are observed when tried by clicking 'Resolve Clock Issues' could not be resolved.

 

How can I improve execution time from 20ms to 1 ms?

34 REPLIES 34

Still not catching the point yet but if you set the clock to 8 there is a warning popup indicating that the HCLK clock should be between 25MHz and 180MHz:

SofLit_0-1707306262130.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

So it means, that HCLK is supposed to be between 25MHz to 180MHz. 

Yes, that is exactly what it says!

 

AndrewNeil_0-1707308035079.png

 

You will also find these specifications in the device datasheet.

SofLit
ST Employee

Meanwhile, I need to check internally if this constraint on min HCLK value makes sense and it is not a bug in CubeMx

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hi guys,

Normally and at least the MCU could start with HSI which is 16Mhz. To me 25MHz as minimum does not make sense. So it smells a bug in CubeMx.

Moreover in the datasheet in Table 25. "Typical and maximum current consumption in Run mode" 2MHz is there. 

SofLit_1-1707311476208.png

I'm raising the behavior internally to confirm the bug and fix it. I will come back to you for any feedback.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

MCU should clock down to DC.

Suspect the threshold instead relates to some other peripheral, perhaps clocked independently from 48 MHz, like USB, SDIO or CRYP

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> Meanwhile, I need to check internally if this constraint on min HCLK value makes sense

It's consequence of having enabled ETH or USB.

JW


@Tesla DeLorean wrote:

MCU should clock down to DC.


Indeed:

AndrewNeil_0-1707312568062.png

So concur that the minimum must be a dependency on something else ...


@SofLit wrote:

 I need to check internally if this constraint on min HCLK value makes sense and it is not a bug in CubeMx

 


Maybe it's thinking of this:

AndrewNeil_2-1707312841749.png

 

SofLit
ST Employee

@Tesla DeLorean @waclawek.jan ,

Yes indeed .. I didn't notice that USB and ETH were enabled in the ioc file.

Thank you guys for pointing me this out :folded_hands:

@KumarTP You need to disable USB and ETH in your ioc file to reach lower frequencies, as these peripherals need at least 25MHz for HCLK to work correctly.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.