2022-04-29 01:48 AM
I am using stm32h7 with threadx where TIM6 is time timebase for HAL and systick is used by threadX. The project is generated using the standard cubeMX configuration. I am using tracelyzer to visualize my CPU utilization, and i found out that TIM6 ISR is taking almost 60 % of the CPU, which to me makes no sense as it takes few us to execute and has a period of 1ms.
The remaining system (ISRs and Tasks) consume only 11% of the CPU. Am i doing somthing wrong because i cannot do proper RMA of my system.
2022-04-29 02:57 AM
Show us the ISR code, maybe threadx is doing something inside that ISR?
2022-04-29 03:02 AM
thanks Javier for reply.Here is my ISR code:
void TIM6_DAC_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_DAC_IRQn 0 */
vTraceStoreISRBegin(TimerHandle6);
/* USER CODE END TIM6_DAC_IRQn 0 */
HAL_TIM_IRQHandler(&htim6);
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */
vTraceStoreISREnd(TimerHandle6);
/* USER CODE END TIM6_DAC_IRQn 1 */
}
Where vTraceStoreISRBegin and vTraceStoreISREnd are tracning functions. and the callback is:
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM6) {
HAL_IncTick();
}
}
Nothing sophisticated
2022-04-29 04:05 AM
If you know that the ISR period is 1ms and duration a few us (and both of these you can easily verify by toggling an output pin at beginning and end of ISR and observing on oscilloscope/LA), then the mechanism through which you are told the CPU utilization is faulty.
JW