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.

Analog output on analog pins of DK-TM4C123G



I've run some basic programs on dk-tm4c123g. Now I would like to get some analog output on GPIO pins which I can control digitally. I skimmed through the datasheet & user guide but could not find significant info on analog output. Other methods suggested on forums were external DAC & LPF to PWM; but is there another way analog output can be obtained? Please suggest some good resources if possible. I'm looking for the functionality close to Arduino's " AnalogWrite() ".

  • I skimmed through the datasheet & user guide but could not find significant info on analog output.

    Perhaps because the TM4C123 does not have any DAC / analog output peripheral ? Seems TI decided most customers don't need internal DACs, or are unsatisfied with their performance. Some competitor's MCUs (namely STM32) feature one or two-channel 12-Bit DACs in most devices.

    Other methods suggested on forums were external DAC & LPF to PWM; but is there another way analog output can be obtained?

    You named it. Serial, general-purpose DACs (I2C, SPI) are cheap. Only stay away from specialized Audio- and RF-DACs, these are not for beginners.

    A PWM output with a following lowpass filter is the easiest method to generate an analogue signal. However, that does not give you much control over the amplitude.

    Please suggest some good resources if possible.

    That depends on your requirements.Try your favourite search engine ...

  • Hello f.m.,
    Thanks for your inputs, they should help me a lot. For the resources part, could you suggest some resources on the use of serial, general-purpose DACs you mentioned with tm4c123g? Just point-me-in-the-right-direction sort of resource should do good.
    Thanks & Regards,
    Monil
  • You could use a few output bits and an R/2R ladder to create a DAC but I wouldn't suggest that unless you

    • are very cost constrained
    • have extra outputs doing nothing
    • don't need much accuracy

    Really an SPI DAC (some are very inexpensive) or PWM are really the way to go.

    Robert

  • Really an SPI DAC (some are very inexpensive) or PWM are really the way to go.

    Exactly.

    The datasheet of those DACs should provide sufficient information, at least for an experienced user. Just go to the website of your "favourite" electrinics supplier (Mouser, Digikey, etc.), search for e.g. "DAC", "SPI" (I suggest one available in a DIP housing ...), select one, and download it's datasheet. Additionally, it should be 3.3V logic compatible, and require a minimum of components.

    For PWM, the simplest form uses a RC network as lowpass filter. But that suits your need only for a fixed-amplitude output.
  • Hello Robert,

    Might a simple Potentiometer also help, though the output is mostly unbiffered

    Regards
    Amit
  • I don't think so Amit.

    Unless you are thinking of one the various E pots? Those are too fragile for most uses and SPI DACs are cheaper. I'd stay away unless you absolutely needed a resistance.

    Robert
  • Hello Robert,

    Agreed. It is that the R n/w can be used to control amplitude of the signal. Of course a SPI DAC will achieve the same, but how many times our kind posters have run into SPI not working.

    Regards
    Amit
  • Well Amit, the E Pots I've seen are either SPI or U/D (which is more complicated to get working correctly).

    Robert
  • Hello Robert,

    Bit banging has served us well, especially on the U/D. But to think of it SPI has the advantage of "autonomous" speed.

    Regards
    Amit