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

The idea is to reduce program compiling time. Now it is taking 20ms, trying to reduce compiling time from 20ms to 1ms.( need to speed up ) And there are no other peripherals used.

Compilation time? or execution time??

Unfortunately you add more confusions than clarifying your expectations ..

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.

oops sorry, execution time.

Some tips to speed up program execution:

  • Increase the system frequency
  • Enable instruction and data cache if the program is executed from the internal Flash:
#if (INSTRUCTION_CACHE_ENABLE != 0U)
  __HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
#endif /* INSTRUCTION_CACHE_ENABLE */

#if (DATA_CACHE_ENABLE != 0U)
  __HAL_FLASH_DATA_CACHE_ENABLE();
#endif /* DATA_CACHE_ENABLE */

#if (PREFETCH_ENABLE != 0U)
  __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
#endif /* PREFETCH_ENABLE */
  • You can also use internal RAM for code execution (0-wait-state like).
  • Optimize for speed in your IDE

It could be there are some other tips but these are the ones came to my mind at the moment.

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.
LCE
Principal

Maybe you give us some short description of what your "program" is doing.

And how are you measuring these obscure 20 ms ? 

Maybe you are using polling functions, while-tick-loops, ... so many things that can go wrong. But letting us guess doesn't help us help you. ;)