Best use of timer and timer modes
Hello all and tks for reading,
I will develop a three-phase 60Hz rectifier, 12 pulses, thyristor controlled. The mpu to be used is the stm32f303RE and I will make the prototype on a Nucleo-64 board.
The mpu control signals will go to an already existing board, which limits the use of some pins. For example, I won't be able to use the timer channels directly, they will be triggered as GPIO's.
The mpu will receive the zero crossing signals on three pins that will be configured as external interrupts for the three phases with zero phase shift. I understand that I will need the "virtual" zero crossing to be used in the three phases shifted 30 degrees. This lag represents a delay of 1.39ms. The gates are a total of six, 3 pins for zero degrees phases and 3 pins for phases 30 degrees.
I did some tests and I'm leaning towards using OC mode, it worked right away, but pwm is still on the radar.
In this post, I would like to hear your opinion on the use of timers, it seems to me that the way I think of using them is a bit exaggerated. I think I will:
a) use timer 1 for 3 phases with zero degrees of delay (I did the test in OC mode on channels 4, 5 and 6 only as a "frozen" timer, but channels 5 and 6 did not work).
b) use timer 3 for 3 phases with a shift of 30 degrees, noting that the same thing that happened in T1 regarding channels 5 and 6 must occur in T3.
c) use timers 6, 7 and 16 to create the delay, with the countdown to interrupt every 1.39ms after the start at zero crossing.
The logic of sequential events would be when a zero crossing occurs (for each phase):
a) reset of the gate zero degrees of corresponding phase (channel)
b) load the channel timing value (calculated separately) to adjust the output voltage
c) start the channel timer for OC interrupt of T1
d) start T6 (depending on the phase, it could be T7 or T16) loaded to generate an interrupt after 1.39ms
Then, when the T6 callback occurs (or T7 or T16, depending on the current phase):
a) stop T6
b) reset the T6 counter
c) 30 degree offset gate reset
e) load the channel timing value of T3
f) start T3 channel in interrupt OC mode
The T1 callback, when it occurs, produces the corresponding gate set (which will be reset at the next zero crossing). The same goes for the T3 callback, with the difference that the gate with a 30 degree shift will be reset when the timer that produces the delay starts (T6, T7 or T16).
After the explanation above, my questions are:
a) Is there no way to avoid the use of T3, making all activations only using T1? (I didn't see a specific way to do it, but I didn't get to explore all the possibilities of T1, hence the question)
b) if there is any way to use the six channels of T1, how would it be to generate the 30 degree offset by T1 itself, would that be possible? how?
c) it seems that there is a high consumption of timers to produce the delay (T6, T7 and T16). Is there no way to use a smaller number of timers?
d) at the current stage of development, the options are open. I would like to know if the approach (the concept), shown above, is correct or would you suggest a different approach?
Thanks so much for reading and for any responses,
Best regards,
Luiz