2024-02-21 04:48 AM - edited 2024-02-21 05:01 AM
I cant make work the HRTIM. I am using the weact board.
I tried HRTIM-A and TRTIM-D using the cubeide (latest updated). the first one using "basic HAL" and the second using "Advanced Hal" instructions
TIM5 works so it seems that clock is working.
I added following code to make run the timers and the debugger passed them without trouble:
MX_HRTIM_Init();
if( HAL_HRTIM_WaveformOutputStart(&hhrtim, HRTIM_OUTPUT_TD1)!= HAL_OK)
{
Error_Handler();
}
if (HAL_HRTIM_WaveformOutputStart(&hhrtim, HRTIM_OUTPUT_TD2)!= HAL_OK)
{
Error_Handler();
}
if (HAL_HRTIM_WaveformCountStart_IT(&hhrtim, HRTIM_TIMERID_TIMER_D)!= HAL_OK)
{
Error_Handler();
}
if (HAL_HRTIM_WaveformCounterStart(&hhrtim, HRTIM_TIMERID_TIMER_D)!= HAL_OK)
{
Error_Handler();
}
if ( HAL_HRTIM_WaveformSetOutputLevel(&hhrtim,
HRTIM_TIMERINDEX_TIMER_D,
HRTIM_OUTPUT_TD1,
HRTIM_OUTPUTLEVEL_ACTIVE)!=HAL_OK)
{
Error_Handler();
}
if ( HAL_HRTIM_WaveformSetOutputLevel(&hhrtim,
HRTIM_TIMERINDEX_TIMER_D,
HRTIM_OUTPUT_TD2,
HRTIM_OUTPUTLEVEL_ACTIVE)!=HAL_OK)
{
Error_Handler();
}
if (HAL_HRTIM_WaveformCountStart_IT(&hhrtim, HRTIM_TIMERID_TIMER_D)!= HAL_OK)
{
Error_Handler();
}
if (HAL_HRTIM_WaveformCounterStart(&hhrtim, HRTIM_TIMERID_TIMER_A)!= HAL_OK)
{
Error_Handler();
}
if ( HAL_HRTIM_WaveformSetOutputLevel(&hhrtim,
HRTIM_TIMERINDEX_TIMER_A,
HRTIM_OUTPUT_TA1,
HRTIM_OUTPUTLEVEL_ACTIVE)!=HAL_OK)
{
Error_Handler();
}
if ( HAL_HRTIM_WaveformSetOutputLevel(&hhrtim,
HRTIM_TIMERINDEX_TIMER_A,
HRTIM_OUTPUT_TA2,
HRTIM_OUTPUTLEVEL_ACTIVE)!=HAL_OK)
{
Error_Handler();
}
Here are the configurations of the cubeide:
TIMER-D configuration:
TIMER-A configuration:
MASTER TIMER CONFIGURATION:
Solved! Go to Solution.
2024-02-21 07:42 AM
After making this:
HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TA1);
HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TA2);
HAL_HRTIM_WaveformCounterStart(&hhrtim1, HRTIM_TIMERID_TIMER_A) ;
HAL_HRTIM_WaveformSetOutputLevel(&hhrtim1,
HRTIM_TIMERINDEX_TIMER_A,
HRTIM_OUTPUT_TA1,
HRTIM_OUTPUTLEVEL_ACTIVE);
HAL_HRTIM_WaveformSetOutputLevel(&hhrtim1,
HRTIM_TIMERINDEX_TIMER_A,
HRTIM_OUTPUT_TA2,
HRTIM_OUTPUTLEVEL_ACTIVE);
Worked the Timer A1 but not the A2, that is due Weact board uses the HRTIM legs to connect to USB ,camera, display. I recommend build a custom board.
2024-02-21 07:42 AM
After making this:
HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TA1);
HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TA2);
HAL_HRTIM_WaveformCounterStart(&hhrtim1, HRTIM_TIMERID_TIMER_A) ;
HAL_HRTIM_WaveformSetOutputLevel(&hhrtim1,
HRTIM_TIMERINDEX_TIMER_A,
HRTIM_OUTPUT_TA1,
HRTIM_OUTPUTLEVEL_ACTIVE);
HAL_HRTIM_WaveformSetOutputLevel(&hhrtim1,
HRTIM_TIMERINDEX_TIMER_A,
HRTIM_OUTPUT_TA2,
HRTIM_OUTPUTLEVEL_ACTIVE);
Worked the Timer A1 but not the A2, that is due Weact board uses the HRTIM legs to connect to USB ,camera, display. I recommend build a custom board.