cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 set duty cycle of HRTIM1

megahercas6
Senior
Posted on September 23, 2017 at 12:32

Hello, I am trying STM32H7 HRTIM1, i could set duty cycle and period when i first initialize timer, but after that, i can't change duty cycle. usually, i write direly to compare register, but now it has no effect. I am running HRTIM1 TD1 and writing HRTIM1->sTimerxRegs[3].CMP1xR = newvalue; dosent to anything, while it what is done in init function to set timer in the first place. Could any one give me explanation how to do it ?

Thanks

#stm32h7 #hrtim1
2 REPLIES 2
megahercas6
Senior
Posted on September 23, 2017 at 18:59

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6tH&d=%2Fa%2F0X0000000bxR%2FjfqQNpxeLPbxj5iPxhNHg2.x6z3.hjP_tjM8so9oyoE&asPdf=false
Posted on June 07, 2018 at 14:21

I was having the same problem. I would update the period, but the output waveform would not change. In the Reference Manual, I found that one needs to set one of the update event modes for changes to take effect. In CubeMX. change the following line to enable updates on timer reset or expire.

 sConfig_timerD.ResetTrigger = HRTIM_TIMRESETTRIGGER_NONE; // will not update

to

 sConfig_timerD.ResetTrigger = HRTIM_TIMRESETTRIGGER_ENABLED;   // updates

I am using the HRTIM to provide a programmable external clock. It works great.