My company is evaluating Kinetis chips for an new project. I've just recently started working with the TWR-K60F120M tower kit via Kinetis Design Studio and have been quite successful so far (interfacing with UART, ADC, misc Timer configs, etc...); however, I am having trouble getting output from the DACs. In KDS, I select the DAC component in the Components Library (DA1=DAC0, DA2=DAC1), use defauls (right justified/unsigned, enable on init, pin output enabled, etc...), generate the code and have adapted mainline code from the component "Typical Usage" help page (see below). I receive no compilation errors and debugging shows that my code seems to be doing what I want...except I'm not getting any output... I'm probing pins A32 (DAC0_OUT) and B32 (DAC1_OUT) on the edge connector, using TP17(GND) as my probe ground and I'm expecting to see a sawtooth, but no dice.
Has anyone had similar issues or provide some assistance with my problem? Any feedback is greatly appreciated.
word i = 0;
for(;;) {
if (i==4095) {
i=0;
} else {
i++;
}
DA1_SetValue(&i);
DA2_SetValue(&i);
}
Regards,
Aaron
Solved! Go to Solution.
I solved my problem:
1. It was necessary to change the "voltage reference source" of DacLdd1 and DacLdd2 from "internal" to "external". This got some output, but the peak voltage was quite low (a couple hundred millivolts)...
2. DAX_SetValue() seems to do a four bit right shift (>>4) of shorts/words to set the 12 bit DAC output. Changing the "I" rollover point from 4095 to 65535 get me the 3.3V sawtooth I expected.
Hope this helps someone else down the line.
Regards,
Aaron
I solved my problem:
1. It was necessary to change the "voltage reference source" of DacLdd1 and DacLdd2 from "internal" to "external". This got some output, but the peak voltage was quite low (a couple hundred millivolts)...
2. DAX_SetValue() seems to do a four bit right shift (>>4) of shorts/words to set the 12 bit DAC output. Changing the "I" rollover point from 4095 to 65535 get me the 3.3V sawtooth I expected.
Hope this helps someone else down the line.
Regards,
Aaron