AnsweredAssumed Answered

ADC DMA control of PWM duty cycle, but with second channel and deadtime

Question asked by kragelund.klaus on Oct 27, 2012


We are using the STM32L151.

I want to use an analog input to control the duty-cycle of a PWM output. I am using DMA, so the CPU has no intervention since I will be running the duty-cycle updates fast.

However, I need the ADC value to control the duty-cycle of PWM channel 1 and have another channel (PWM channel 2) with the same duty-cycle, except it needs to have a deadtime before and after the reference dutychannel. (see for how the signals should be)

The reference duty-cycle will be center alligned.

Is there a way to do this? (sorry if this is a basic question)

If this cannot be solved in SW, I guess I could use two ADC inputs, a seperate DMA transfer to make the individual PWM output, and add an offset voltage to the second ADC input to let the PWM output of this channel have a certain deadtime, but that is not very desirable, since it needs HW to configure the deadtime.