cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_HRTIM_IRQHandler duration is very long

victagayun
Senior III

Hello I have NUCLEO-G474RE running at 170Mhz (24Mhz HSE [div 6] [mul 85] [div 2]) .

I am using Master and TimA $ TimC hrtimer as PWM for SMPS running at 100kHz (10uS).

I want to check how much available time for me if I interrupt every period and update the duty cycle using compare unit.

I add an IO to check the duration, it took around 7.44uS??

So that means I have only left around 2.65 uS for my code?

void HRTIM1_Master_IRQHandler(void)
{
  /* USER CODE BEGIN HRTIM1_Master_IRQn 0 */
 
  GPIOC->BSRR = (1<<10); // up
 
  /* USER CODE END HRTIM1_Master_IRQn 0 */
  HAL_HRTIM_IRQHandler(&hhrtim1,HRTIM_TIMERINDEX_MASTER);
  /* USER CODE BEGIN HRTIM1_Master_IRQn 1 */
 
  GPIOC->BSRR = (1<<26); // down +16
 
  /* USER CODE END HRTIM1_Master_IRQn 1 */
}

12 REPLIES 12
berendi
Principal

HAL_HRTIM_RepetitionEventCallback() is an empty function (unless you put some code in there), so it will execute very fast. Why would you call it?

victagayun
Senior III

To replace

HRTIM1_Master_IRQHandler(void)

which includes

HAL_HRTIM_IRQHandler(&hhrtim1,HRTIM_TIMERINDEX_MASTER);

which is around 4uS.

If I use the call back instead, which I haven't tested yet, would it be better, ie less overhead?

berendi
Principal

Check the source of HAL_HRTIM_RepetitionEventCallback() in the HAL sources. What is in there?