2020-07-29 03:10 AM
I am using cubeIDE and I'd like to know how I can time my code, to see how long individual sections take to run and troubleshoot timing issues. How can I do this?
2020-07-29 04:48 AM
Hi PGoul,
I would say you can find interesting informations in the log section of the cubeIDE (console).
See below an example where the needed time for the project build took around 3 seconds
As modifying your code you can see each time the needed time in the console and compare the results.
I hope this help!
-Imen
2020-07-29 04:55 AM
Use a free running maximal TIM, perhaps a 32-bit one clocking at 1 MHz, read values entering / exiting a code section. Could clock at higher speed for more precision.
Check also DWT_CYCCNT for core cycle count
2020-07-29 08:28 AM
Run time, not compile time..
2020-07-29 08:42 AM
If you have timing issues, first try to view your running code in your mind and try to find out logically.
When needed, if you have some spare pins toggles some GPIO on oscilloscope to view what's going on.
Having a critical timing gets tricky. Are you talking about max interrupt latency and duration/priority issue here?
2020-07-29 11:25 AM
Use DWT cycle counters. It can show you the number of cpu cycles between two successive break points. you should first enable it in your init phase. Cycle counters are available in SFR register view in cubeide