2024-02-19 07:09 AM
Hello,
In my project I need to have ~25KHz high resolution PWM generation. So for this I selected STM32H753 with 480MHz HRTIM1.
I am struggling producing correct outputs for my needs, maybe some one has this done already and care to share the project ? Problems I am facing:
Ok, so the first problem I don't know how to deal with. it looks like HRTIM1 does actually have one master timer and many other timers with it's own period counters. In order to synchronize PWM outputs, it looks like I need to use master timer for it somehow. It does have many compare units also a period counter. what is correct way of generating simple 3 channels of synchronized PWMs? (why where are no example for this task, it looks it should me main example in my mind...)
Can I simply use compare units on master timer and TX1 and TX2 would just add dead time ? or i need to set master timer period lower and start each timer in one "single shot mode" with pulse with selected in CCR register ?
Second problem is how to properly align ADC sample points on each phase. Problem I face is that I routed current sence to pins, that are only ADC1/2. Does this mean I can't have perfect sample point on each phase, and best I can do is selecting lowest PWM width middle point for current measurement ?
Looking forward for ideas, and in the mean time, going to read RM and see how it goes
2024-09-03 11:53 PM
Hello,
In order to synchronize all PWM, Master timer period (or compares in master timer unit) could be used as a reset source for other timer unit. This will ensure all timers roll-over at the same moment. Make sure also please to enable all Timer units with one call of HAL_HRTIM_WaveformCountStart. Then you can ensure an ADC synchronization by triggers event from HRTIM defined by compares.
Best regards.