AnsweredAssumed Answered

DAC output toggling

Question asked by Alexander Farley on Feb 21, 2017
Latest reply on Feb 21, 2017 by Alexander Farley

I'm trying to get a basic DAC example working on the FRDM-K22F board using Processor Expert. 


I've configured a DAC (Legacy High-Level component) using an underlying DAC (Logical Device Driver). The issue I'm having is that the DAC output seems to jump around/toggle but doesn't exactly reflect the value I'm trying to assign. 


I have a loop incrementing a variable and assigning to the DAC, so I was expecting a sawtooth waveform:

sprintf(dacString, "DAC: %d", dacValue);
dacValue += 10;
if(dacValue > 4000)
dacValue = 0;


However, what I actually see is a toggling signal between 0V and .16V before eventually jumping directly to 3.3V. So here's the dacValue vs the output voltage:

dacValue: 0 voltage: 0 V

dacValue: 10 voltage: 0.16 V

dacValue: 20 voltage: 0 V

dacValue: 30 voltage: 0.16 V

dacValue: 40 voltage: 0 V

dacValue: 50 voltage: 0.16 V

dacValue: 60 voltage: 0 V

dacValue: 70 voltage: 0.16 V


dacValue: 400 voltage: 3.3 V


Eventually, the dacValue drops again/jumps around in the range 0-3.3V. 


Any idea what is causing this? Here is my DAC configuration from PE:


12 bits

Left justified/unsigned

Init value: 0

D/A resolution: 12 bits

Low power mode: unchecked

Voltage reference source: external