cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the STM32G474 HRTIM to variable frequency with constant on-time?

JLadm.1
Associate

Hello

I'm trying to set the HRTIM to generate fixed on-time and variable frequency.

Now I can set the frequency precisely but the duty cycle is somehow held at 50 %.

I have found that similar behavior is expected in so-called "half mode", but the half mode isn't enabled.

I even tried to recover the original compare values, right after setting the period register, but nothing changed.

STM32CUBEMX ioc file and main.c files attached for reference

Thank you very much.

1 REPLY 1
Jiri VLCEK
ST Employee

Hello,

You can try to use direct register's access:

HRTIM1_TIMA->PERxR = (new_value);

HRTIM1_TIMA->CMP1xR = (new_value);

The change should be visible on pin immediately.

Best Regards,

Jiri