2025-10-31 10:09 AM
Hi,
Any help would be appreciated!
I am trying to generate a project on an STM32G474ET where I use HRTIM timer C outputs as a complementary PWM output pair. I've not been able to get this working, so I have stripped this back to simply a single PWM output on HTIM1 Timer C. However I cannot get the chip to produce a PWM output.
When I call "HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TC1);" the ODSR bit for timer C "Timer C Output 2 disable" is getting set and will not clear. I can't find any condition in other registers that would set the ODSR bit.
Below I have outlined:
Does anybody have any idea of what could be going wrong here??
Call stack:
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_ADC1_Init();
MX_ADC2_Init();
MX_FDCAN1_Init();
MX_HRTIM1_Init();
MX_TIM3_Init();
MX_TIM4_Init();
MX_USART2_UART_Init();
MX_USART3_UART_Init();
MX_ADC3_Init();
HAL_HRTIM_WaveformCounterStart(&hhrtim1, HRTIM_TIMERID_TIMER_C);
HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TC1);
My .ioc file for HTIM1 is as follows:
File.Version=6
HRTIM1.ADCTrigger_Id1=__NULL
HRTIM1.ADCTrigger_Id2=__NULL
HRTIM1.ADCTrigger_Id3=__NULL
HRTIM1.CompareUnit1-Output_TC1=HRTIM_COMPAREUNIT_1
HRTIM1.CompareValue1-Output_TC1=3000
HRTIM1.EnableCalibration=NoDLLCalibration
HRTIM1.IPParameters=ADCTrigger_Id1,ADCTrigger_Id2,ADCTrigger_Id3,EnableCalibration,Periode_TC,PreloadEnable-Output_TC1,CompareUnit1-Output_TC1,CompareValue1-Output_TC1,NumberSetSource1-Output_TC1,SetOutput1_Source1-Output_TC1,NumberResetSource1-Output_TC1,ResetOutput1_Source1-Output_TC1
HRTIM1.NumberResetSource1-Output_TC1=1
HRTIM1.NumberSetSource1-Output_TC1=1
HRTIM1.Periode_TC=8400
HRTIM1.PreloadEnable-Output_TC1=HRTIM_PRELOAD_ENABLED
HRTIM1.ResetOutput1_Source1-Output_TC1=HRTIM_OUTPUTRESET_TIMPER
HRTIM1.SetOutput1_Source1-Output_TC1=HRTIM_OUTPUTSET_TIMCMP1
KeepUserPlacement=false