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.

MSP430 PWM DAC resolution

Other Parts Discussed in Thread: DAC8311

Hi,

One of our customer is planning to use MSP430F6xx series
and wants to implement 14bit DAC using the Timer PWM.
We wonder is it possible to use Timer PWM to implement high resolution DAC?

Please let me know if anybody has tried 14bit DAC with MSP430 Timer.

Regards
Paddu

  • I think that the answer is no. You could be tempted to think in that direction because the PWM is based on a 16 bit timer. But PWM based DAC are for course applications, like controlling the speed of a motor or the brightness of a LED. Consider that the "high" and "low" states of the PWM output, which also affect resolution, are not based on a precision analog reference but are digital. So the lack of precission for the "high" and "low" voltages is rather high. I doubt that you could reach even 7 bits resolution.

  • Well, teh tiemr output voltage is pretty much 0V and VCC if you do not load the output with current. So yes, a 16 (or 14) bit PWM DAC is possible. However, converting a PWM signal into an analog voltage requires a very-low-pass filter.
    Driving the timer with 16MHz and 14 bit PWM resolution (=16384 ticks per cycle) results in only 2kHz PWM frequency. If you filter this down to a ripple-free analog voltage, you won't get past a few Hz ADC output frequency.
    That's the real limitation.

    The MSPs with a High-Speed TImerD might give you an additional factor of 16, but still nothing that can be used for something else than low-speed controlling purposes.

  • Sorry Jens but I don't agree. "Pretty much" is not a definition for the value of a voltage, when we are talking about precissions in the order of tens of uV, under varying conditions of temperature, etc. The manufacturer doesn't define nothing about the precission of this digital output, how can we assume any value for a precission application?

    Moreover, the power supply for a digital part is generally one with a very poor precission, 2-3% is considered good enough, how can this precission on the P.S. be converted to a precission of the order of 0.001% at the output of the PWM? And even if the P.S. was a precission one, the manufacturer by definition does not promise that this precission will be observed at the output, since it is a digital output.

    I think that those are also limiting factors, and you won't achieve any significant precission even at very low frequencies. Surely not 16 nor 14 bit level precission.

    The only way out I can see is to use a precission voltage reference with an analog switch controlled by the PWM. In that case, the limitation would be only the frequency.

  • Albert_83 said:
    Sorry Jens but I don't agree. "Pretty much" is not a definition for the value of a voltage

    For 0mA output current, it is 0mV output voltage. See the datasheet. 'pretty much' was referring to the fact that the output current is likely greater than zero when using it for anything :)

    You're right, VCC is a significant factor. However, on 3V VCC, 14 bit precision means 183µV/count. So we are inthe order of hundreds of µV. And stabilizing VCC is surely not a big problem too. Also, you can route the tiemr output to an external driver stage that has a precision voltage as reference. A simple JFET would do the trick.

    I agree that a high-precision 14 bit DAC is out-of-question. But the result will definitely better then the 7 bit you 'offered'.

    Still, the limiting factor is the required low-pass and the resulting low output frequency

  • OK, so we agree that the voltage should be external, like a precission reference switched by the PWM.

    The issue of low output frequency can be addressed and improved using this method of synchronous filtering:

    http://edn.com/design/analog/4323340/Fast-settling-synchronous-PWM-DAC-filter-has-almost-no-ripple

     

    My conclussion at this point is to emphasize that when thinking of a "PWM DAC", both the output voltage building and the filtering have to be carefully taken into consideration. A bare bones PWM, which outputs a digital voltage with a simple low pass filter, won't be able to achieve a precission DAC solution.

    And even if we provide an external precission voltage, and filter the PWM synchronously, we still have to address another issue we have not commented yet: the precission of the timer itself.

  • Albert_83 said:
    we still have to address another issue we have not commented yet: the precission of the timer itself.

    Right. If the timer is driven by modulated DCO, all precision efforts are in vain. However, with a crystal. the timer is clocked without noticeable jitter at a stable frequency, and the outputs are switched by hardware within a few ns after the clock edge, so I doubt that any external circuitry will be more precise.
    Also, the absolute crystal frequency is unimportant too, as the filtered signal depends on duty cycle of the timer PWM, not on the PWM frequency.
    Well, if the DCO is used wihtout modulation and with a fairly stable VCC and operating temperature, it too might be sufficient. The main influence on precision is drift/jitter during one PWM cycle, not the long-time stability.

    The final quesiton is: how much precision is needed and how much (in terms of programming effort or hardware costs) you want to pay for it.
    Usually, the initial constraints for a project are way, way too narrow, and on secodn thought, they can often be lowered by magnitudes without noticeable effect on the result (due to other effects that have much more impact). E.g. what good is a sub-ns-latency when the limiting factor is human reaction time?

  • So we need a precision voltage reference, a fair analog switch, a synchronous filter, a crystal clock... and we still won't be able to go much further than a few hundred Hertz. Maybe a ready made DAC with SPI is a simpler, faster, less footprint... and even cheaper solution. Like the DAC8311.

    Anyway, it was interesting to discuss the solution together :)

     

  •  Hi good discussion, but not only PWM can be used to do AD conversion, timer can be used to measure time and this way a double integration conversion can be made measuring integration time of unknown and reference voltage. This can be done with internal comparator or an external too and resolution is not limited to 14 bit but to floor noise of circuit. These circuits cannot do more than few convert @ second so integration remove a lot of noise and if sampling period is near even integral line frequency period it remove hum noise too.

     So why not old good analog conversion technique?

  •  Hi, how fast conversion need to be?

  • Hi Roberto,

     

    We are talking about digital to analog, and not analog to digital.

    The good old way for DAC would be to use discrete R-2R network, but that is something I would definetly NOT do for trying to achieve 14 bit, with discrete components.

  • Albert_83 said:

    We are talking about digital to analog, and not analog to digital.

    The good old way for DAC would be to use discrete R-2R network, but that is something I would definetly NOT do for trying to achieve 14 bit, with discrete components.

     Ooops Sorry for mistake, but this way the problem is different, again high speed timer can suit this need and more than 14 bit can be obtained with a low cost switch with a reference voltage on one side and a filter on the other or just a sync filter like the one you pointed by using just a better switch. Audio/video conversion get from this way so why not a voltage from a controller too? All depend on SFDR than resolution.

    R2R ladder has too much SFDR, switching noise and is coupled to VCC rail so power noise appear at output just 6dB less. This result in an acceptable bit error and require one switch every bit... An SPI DAC is far more better than if you use R2R to do educational purpose.

  • Albert_83 said:
    Maybe a ready made DAC with SPI is a simpler, faster, less footprint... and even cheaper solution.

    Well, it requires SPI, well-timed transfers for the data update, four I/O pins (SIMO, SOMI,SCL and CS and maybe even a ready signal). And the precision, well, the internal reference o fmost DACs isn't that precise too. But faster, definitely. And maybe less footprint and cheaper.

    Things can be done fast, cheap and precise.
    fast and precise isn't cheap
    fast and cheap isn't precise
    cheap and precise isn't fast
    fast, cheap and precise isn't possible.

    Albert_83 said:
    Anyway, it was interesting to discuss the solution together :)

    Those discussions are the cream on the cake. :)

  • Jens-Michael Gross said:
    Those discussions are the cream on the cake. :)

     MMMMhhh good way but taste of both cream and cake are missing ;)

**Attention** This is a public forum