Hi,
What I am trying to do is: two triangular waveforms out of phase with each
Now I'm confused.
This sentence clearly says you want two triangular waveforms...--> I assume this is not possible without additional circuitry
From the post#1 I thought you want to generate two square waves.
I'm not familiar with STM32...
But with other microcontrollers.
I see several possible solutions:
1) maybe the PWM hardware is cofigurable for this --> read datasheet
2) use two counters, each used for one PWM. Start one counter, delay the start of the second counter by 50% of the first counter.
The above need no processing power, no ISR.
Now with ISR:
3) run one counter. Run it with twice the expected frequency. On TOP interrupt alternatively SET the PWM outputs. At compare match interrupt alternatively CLEAR the PWM outputs. It needs additional logic when crossing the 50% duty cycle border.
4) use a timer to generate high frequency interrupts. Use two software counters with 50% deviation. Use software compare to set/ clear the port pins.
Klaus