2024-02-07 01:53 AM
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?
2024-02-07 03:44 AM - edited 2024-02-07 08:31 AM
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:
2024-02-07 03:56 AM
So it means, that HCLK is supposed to be between 25MHz to 180MHz.
2024-02-07 04:14 AM
Yes, that is exactly what it says!
You will also find these specifications in the device datasheet.
2024-02-07 04:37 AM
Meanwhile, I need to check internally if this constraint on min HCLK value makes sense and it is not a bug in CubeMx
2024-02-07 05:12 AM - edited 2024-02-07 05:12 AM
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.
I'm raising the behavior internally to confirm the bug and fix it. I will come back to you for any feedback.
2024-02-07 05:23 AM
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
2024-02-07 05:23 AM
> 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
2024-02-07 05:32 AM
@Tesla DeLorean wrote:MCU should clock down to DC.
Indeed:
So concur that the minimum must be a dependency on something else ...
2024-02-07 05:34 AM
@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:
2024-02-07 05:35 AM
@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.