STM32F446 DAC DMA with asymmetrical output
Hi all,
I need to generate a DAC output which is operating on 2 quadrants and the quadrants may be asymmetrical with respect to both the duty cycle and the amplitude. Attached a picture which better explains what I need.
MCU STM32F446RE
DAC OUT1 on pin PA4 - triggered by TIM6
DMA channel 1 stream 5
PWM out: TIM1 CH3 with output on pin PA10
frequency range: 10-500Hz (frequency of the DAC waveform)
The PWM output is controlling the polarity while the DAC is controlling the output amplitude. The polarity must be changed when the DAC output completes 1 cycle.
I need ideas on how to implement it. Since the DAC output is asymmetric I don't know how to create the LUT: should I create a complete LUT with both the quadrants or should I change the LUT array at the polarity change ?
In the first case I don't know how to trigger the PWM output in sync with the DAC waveform while, in the second case, I don't know if I have enough time to recalculate the LUT at the polarity change.
Another option I was thinking is to use a standard GPIO (on pin PA10) instead of the PWM, which I can toggle at the DAC zero crossing, but this will need to "ping-pong" between 2 different LUTs and I don't know how to do it.
Ay ideas on how to proceed ?
Thanks,
Max
