Proper output config for complementary HRTIM outputs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 4:46 AM - last edited on ‎2025-01-30 4:56 AM by Andrew Neil
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();
}
Solved! Go to Solution.
- Labels:
-
HRTIM
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 9:42 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 8:06 AM
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.
Thanks
Omar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 8:57 AM
My concern is how to initialize the output of TF2. Does either of my examples handle that correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 9:42 AM
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();
}
