cancel
Showing results for 
Search instead for 
Did you mean: 

Proper output config for complementary HRTIM outputs

DavidNaviaux
Senior II

I'm using HRTIM Timer F to create two complementary outputs at TF1 and TF2 with deadtime.  I'm finding conflicting examples of how to set the output configuration of the two outputs.

Which of these code segments is correct?

 

  pOutputCfg.SetSource = HRTIM_OUTPUTSET_MASTERCMP3;
  pOutputCfg.ResetSource = HRTIM_OUTPUTRESET_TIMCMP1;
  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF1, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }

  pOutputCfg.SetSource = HRTIM_OUTPUTRESET_TIMCMP1;
  pOutputCfg.ResetSource = HRTIM_OUTPUTSET_MASTERCMP3;
  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF2, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }

 

 

or:

 

 

  pOutputCfg.SetSource = HRTIM_OUTPUTSET_MASTERCMP3;
  pOutputCfg.ResetSource = HRTIM_OUTPUTRESET_TIMCMP1;
  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF1, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }

  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF2, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DavidNaviaux
Senior II

With some search of some sample code, I found that when you have deadtime between TF1 and TF2, TF2 should be initialized with the SetSource and ResetSource set as follows:

 

  pOutputCfg.SetSource = HRTIM_OUTPUTSET_NONE;
  pOutputCfg.ResetSource = HRTIM_OUTPUTRESET_NONE;
  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF2, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }

  

View solution in original post

3 REPLIES 3
Saket_Om
ST Employee

Hello @DavidNaviaux 

For your use case the good implementation is: 

  HAL_HRTIM_WaveformTimerConfig WaveformTimerConfig;
  WaveformTimerConfig.DeadTimeInsertion = HRTIM_TIMDEADTIMEINSERTION_ENABLED;
  ...
  HAL_HRTIM_WaveformTimerConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, &WaveformTimerConfig);
 
  Followed by the deadtime configuration:
  HAL_HRTIM_DeadTimeConfig(...)
 
  pOutputCfg.SetSource = HRTIM_OUTPUTSET_MASTERCMP3;
  pOutputCfg.ResetSource = HRTIM_OUTPUTRESET_TIMCMP1;
  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF1, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }

Please refer to the RM0433(HRTIM section) for more details. 

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

My concern is how to initialize the output of TF2.  Does either of my examples handle that correctly?

 

DavidNaviaux
Senior II

With some search of some sample code, I found that when you have deadtime between TF1 and TF2, TF2 should be initialized with the SetSource and ResetSource set as follows:

 

  pOutputCfg.SetSource = HRTIM_OUTPUTSET_NONE;
  pOutputCfg.ResetSource = HRTIM_OUTPUTRESET_NONE;
  if (HAL_HRTIM_WaveformOutputConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_F, HRTIM_OUTPUT_TF2, &pOutputCfg) != HAL_OK)
  {
    Error_Handler();
  }