This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UCD3138: Controlling duty cycle of DPWM directly from DPWM

Part Number: UCD3138

Dear Sir Madam

I am trying to figure out if UCD3138 is a good fit for my application or not. I need a 1MHz PWM signal where frequency is fixed and duty cycle is directly controlled by external analog signal. Is it possible to bypass the PID controller and have 1). Set the DPWM period register to a fixed value. 2) Set the event registers (DPWMEV1:4) and eventually duty cycle directly from digitized Error ADC (while bypassing the compensator loop). 

In other word, the analog signal that we feed to EAP and EAN directly set the duty cycle without affecting the period.

I guess I couldn't find a way to do that because : 1) The input for DPWM should come from compensator and should pass through the PID loop and 2) The 24 bit output of compensator is split into two 14 bits one for duty cycle and other for period and there is no way to keep the period unaffected.

Also, is there other high resolution PWM generator that fits better to my project requirement?



  • Hello Kaveh,

    Thank you for your interest in UCD3138x devices. The UCD3138x devices should work in your application. In the block diagram, all of the grey lines show possible connections between blocks. While normally designers set the DPWM based on a PID filter, you can absolutely have something else set the DPWM. For example, if you have an EADC that will be a voltage from 0V - 1V that corresponds to the desired DWPM duty cycle, then you can have the EADC value go into a function that converts that duty cycle into the period for each DPWM event. This also could be an ADC or GPIO that triggers the DPWM. Please see the block diagram on page 3 in the UCD3138 datasheet:

    The UCD training labs show how to set the DPWMs events manually. Please see the Digital PWM Module series ( Specifically, video 2 and 3 in the Digital PWM Module series will show how to set the DPWM events manually. Please see the DPWM event set on page 23 of the UCD3138 datasheet:

    Based off of your description, I think you can set up a system something like below. Please let me know if it is correct:

    Lastly, you can find read more about the UCD3138x devices and its advantages: The C2x MCUs are also capable of high resolution PWM signals. You can find a comparison between the two on page 6 of SLUAAS7.


    Jonathan Wong