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.

Using PWM Output as a Digital-to-Analog Converter on a TMS320F28335

Other Parts Discussed in Thread: TMS320F28335, LME49720

Hi TI-guys,

I would like to use out PWM as a analogic output. I have found this document, "Using PWM Output as a Digital-to-Analog Converter on a TMS320F280x Digital Signal Controller", could I use it for TMS320F28335 MCU with safety? Is there any IC (integrated circuit) from Texas Instruments to decoder the PWM?

Best regards

  • Hi Manuel,

    To obtain a DAC from the PWM output, all you need is a Low Pass Filter which you can build from a resistor and capacitor. You should also buffer the output to prevent loading and distorting the PWM signal.

  • Hi Manuel,

    You can certainly use this document for the 'F28335 device as well.  The exact same concepts apply. 

    The other approach to generating an analog voltage from the F28335 is to put down a TI DAC chip which communicates with the C2000 device via SPI/I2C/etc.


    Thank you,
    Brett

  • Hi,

    What kind of buffer ckt r u talking about if u plz tell me in deatil then it will be very helpful for me. Actually I need to produce a output sin wave from PWM signal of TMS320F28335: the sin wave is of 50 Hz and I am using 2KHz of PWM frequency so what order of filter do u suggest and should  I go for an active filter?

  • Hi,

    I meant building a simple voltage follower from an op-amp. I have had good experience with the LME49720 in voltage follower configuration. You can keep the filtering stage passive and add a voltage follower or combine both into an active filter. This is an excellent application note by David Alter that describes how filter order affects the performance of the PWM-DAC www.ti.com/.../spraa88a.pdf. Also should add that you should choose a buffer that fits your load requirements.

  • Hi Frank,

    I have already done it by TLO82CP as a voltage follower configuration and actually it works. I am using RC passive filter (2 nd order)). But the issue is something else. Actually I want to plot a 50 Hz sin wave generated from the board,  but when I use the sin-PWM technique the output sin wave in the oscilloscope after filtering stage is 150 Hz  sin wave. but when i use simple PWM whose average value is DC it is giving DC output.

  • Ok. I'm not entirely clear on how you are generating the sine wave but if you are seeing a 150 Hz signal when expecting 50 Hz, it usually means the timings are not correct. Are you using the SGEN module to generate the sine? For debug purposes, you can keep it simple:

    1. Create a 64 element sine table with a peak value matching the pwm period value.

    2. 50 Hz frequency equates to 20ms period which means you have to run through the 64 element sine table in 20ms to generate a 50 Hz signal.

    3. This means you have to setup a 0.3125ms interrupt to update the pwm compare value with the next value of the sine table.

    4. The pwm frequency has to be faster than the compare update rate so you can increase it to something like 1MHz.

    Let me know how this turns out.

  • Hi,

    Thank you for your suggestion. I got it wright now it is ok. Sir, I have one more question, that what will be the best DAC for my DSP (TMS320F28335).  I am using CCSV4.

  • Actually I am doing the things via Matlab, so I create the sin wave in matlab but I have done the mistake to set the main clock frequency that is why it was showing the frequency three times. Now I have to plot a PLL o/p (periodic triangular wave) but PWM/DAC is not giving a good result. So I want to go for a DAC module. Now what is the best DAC for my system? I am using TMS320F28335 Experimenter Kit with CCSV4.
  • Hi,

    Actually I am doing the things via Matlab, so I create the sin wave in matlab but I have done the mistake to set the main clock frequency that is why it was showing the frequency three times. Now I have to plot a PLL o/p (periodic triangular wave) but PWM/DAC is not giving a good result. So I want to go for a DAC module. Now what is the best DAC for my system? I am using TMS320F28335 Experimenter Kit with CCSV4.

  • Hello,

    Your best chance at getting your latest question answered will be to create a new post. You can link back to this if there is pertinent information in this thread.

    Best Regards,
    Adam Dunhoft
  • user4603550,

    The best DAC for your system would be whatever DAC has the features you need for your application. I can't point you to a single DAC since there are so many variables as far as features is concerned. I recommend you take advantage of the TI filter tool to help pick out the DAC that fits your requirement. Here is a link to it -> www.ti.com/.../digital-to-analog-converter-products.page