• AVR Freaks

AnsweredHot!dspic33ch512mp505 DAC output MCC configuration

Author
debugginglife
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2004/11/25 03:32:28
  • Location: Turkey
  • Status: offline
2019/08/13 01:07:33 (permalink)
0

dspic33ch512mp505 DAC output MCC configuration

Hi,
 
I would like to get analog DC voltage output by pushing data into DAC DATA register.  I cant figure out the settings via MCC.
 
 
For example i will not use comparator (value will be calculated inside, and change time by time), should i enable comparator ? 
 
Thanks
 
 

Attached Image(s)

#1
davekw7x
Entropy++
  • Total Posts : 1806
  • Reward points : 0
  • Joined: 2012/01/16 12:01:07
  • Location: Second star on the right, straight on till morning
  • Status: offline
Re: dspic33ch512mp505 DAC output MCC configuration 2019/08/13 10:01:47 (permalink) ☼ Best Answerby debugginglife 2019/08/14 10:31:58
5 (1)
For example i will not use comparator (value will be calculated inside, and change time by time),
debugginglifeshould i enable comparator

In a word: yes.
The DAC won't work unless you enable the Comparator module
 
debugginglife
I would like to get analog DC voltage output by pushing data into DAC DATA register.

Just store the 12-bit value in DAC1DATH.
 
Tested on my dsPIC33CH128MP508 Curiosity board.
 
Regards,

Dave
 
Footnote: There is a note in the Data Sheet that, "DAC input frequency needs to be 500 MHz."
Your setup can give output when you enable the Comparator module (with clock frequency equal to 90 MHz), but I tried to comply with that note as follows:
 
I set up the AUX PLL for 500 MHz and used that as the CMP1 clock source.  MCC gave a warning that "Input clock frequency should be less than 400 MHz."  It worked in spite of the warning.  Just for kicks I set the prescaler to 1:2 so that the input frequency is 250 MHz.  No more warning from MCC.  Couldn't tell the difference (on a 'scope) with my simple DDS project but I did not attempt any precise measurements (mild external filtering cleans it up enough for my test purposes).  I'm guessing that there might be a Very Good Reason to set it up the way the Data Sheet says, but I didn't follow through beyond my immediate needs. Go figure... 
 
I guess "needs to be" doesn't mean "must be."  At least for a DC mode DAC application. (What a peculiar way of wording the note.)
It might make a difference for more sophisticated applications that use the slope generator and pulse stretching, etc. (like the power supply application in the Curiosity demo program).  For my testbench application, the DAC sample clock is 100 kHz (10 us sample period).
 
post edited by davekw7x - 2019/08/13 12:37:48

Sometimes I just can't help myself...
#2
debugginglife
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2004/11/25 03:32:28
  • Location: Turkey
  • Status: offline
Re: dspic33ch512mp505 DAC output MCC configuration 2019/08/14 10:51:36 (permalink)
0
Thanks Dave,
 
As you said there is warning, i also used AUX PLL clock with 500MHz and lower the frequency later. However i noticed the dspic started to spend much more power when i activate DAC module. Even when i lower the frequency the power consumption has been still around 45mA @4V.
 
Prior to DAC module enabled my power supply showed the setup consumes 7.5mA @4V. (There is a regulator before the dsPIC to regulate voltage to 3.3V)
 
When i activate DAC, the consumption increased to 45mA @4V, which seems very dramatic increase.
 
I tried to lower frequency of APLL by playing post scalar, and DAC scalar registers. However i see glitches on oscilloscope screen. Even though i reduce frequency to lowest limit, power consumption decrease 4mA at all (around 40mA @4V)
 
below the settings without glitches on voltage change on DAC
 
void DAC1_Initialize(void)
{
DACCTRL1Lbits.DACON = 0; // DAC disable - make sure before any change in DAC settings
DACCTRL1Lbits.CLKSEL = 0; //AFVCO/2 - default
DACCTRL1Lbits.CLKDIV = 0; //Clock divide by 1


DAC1DATHbits.DACDATH = 0x0; /*if you need DAC Output set 0x4D9 to 1V (AVDD = 3.3V)*/
DAC1CONLbits.DACOEN = 1; /*Enable DAC 1 output on pin DACOUT1 */
DAC1CONLbits.DACEN = 1; /*Enable Master DAC 1 */

DACCTRL1Lbits.DACON = 1; // DAC enable - be sure to enable
}
 
void InitAPLLClock(void) //clock used for DAC timing
{
// Configure the source clock for the APLL
ACLKCON1bits.FRCSEL = 1;
// Select internal FRC as the clock source
// Configure the APLL prescaler, APLL feedback divider, and both APLL postscalers.
ACLKCON1bits.APLLPRE = 1;
// N1 = 1
APLLFBD1bits.APLLFBDIV = 20;
// M = 20
APLLDIV1bits.APOST1DIV = 2;
// N2 = 2
APLLDIV1bits.APOST2DIV = 1;
// N3 = 1
// Enable APLL
ACLKCON1bits.APLLEN = 1;
}

 
Have i been made something wrong to increase power consumption ?  (There is no load on DAC pin, simply open pin)
post edited by debugginglife - 2019/08/14 10:55:59
#3
Jump to:
© 2019 APG vNext Commercial Version 4.5