SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
In order to measure the CPU cycles as accurate as possible, one of the three available CPU timers was used. The timer was clocked as fast as possible in order to provide the maximum number of counts per execution. So the input clock of the timer was set to the same clock as the CPU with no prescaler. The following code example shows how the timer's count is reloaded and then read after the function of interest is executed:
// reload the CPU timer
HAL_reloadTimer0(halHandle);
// run the controller
CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData);
// get the CPU timer count
timercount = HAL_getCountTimer0(halHandle);
Even though the functions that reload and read the timer count are as efficient as possible, there is an overflow of about 5 CPU cycles which have to be considered when using the data provided in the following sections.
The CPU utilization tables have a minimum column (Min) calculated by running hundreds of thousands of interrupts, and comparing each interrupt cycle time against a minimum, and if it is smaller, the minimum is updated. The same approach was followed to calculate the maximum number of cycles, or the Max column. The Average column was calculated by an accumulative number of cycles, and also counting the number of interrupts used for the accumulation, and then dividing the two numbers. Similarly to the Min and Max column, the Average is calculated over hundreds of thousands interrupts to generate a stable average.
The CPU utilization tables list a few optional configurations, changing three main things:
For the first two, related to the decimation rates, Figure 9-4 shows the entire software execution clock tree of InstaSPIN. This diagram shows how the clocks are divided all the way from the CPU clock to the estimator. We are only changing the highlighted tick rates, since these two are the main contributors of the CPU usage. Changing the speed controller, current controller or trajectory generation tick rates does not change the CPU usage significantly, so those are kept constant throughout the CPU utilization measurements.
For more information about InstaSPIN software execution clock tree, see Section 10.1.
The third parameter that is enabled and disabled for the CPU utilization measurement is the Rs Online recalibration feature.
This is also considered since it impacts the CPU utilization considerably. To learn more about Rs Online recalibration, see Section 16.