How Select DAC Pin...?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How Select DAC Pin...?

2,700 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by h.lotfi on Sat Dec 06 04:29:47 MST 2014
Hi,
i have problem with LPC4357 DAC!!!
i don't know how can i select DAC mode of Analog pins!!!
i want use pin number 8 (in LQFP208 Package), this pin share with ADC0_0 ,ADC1_0, DAC
How can i selec ADC1_0 or DAC Mode in this pin?

and when i want use DAC in P4_4 pin ,i just add this line:
LPC_SCU->ENAIO2 |=(1<<0);

but this pin also doesn't work...

anye body can help me?

i see 3.3V on those pins, and i connect LC filter on VDDA.
Labels (1)
0 Kudos
Reply
9 Replies

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by h.lotfi on Tue Dec 23 08:31:18 MST 2014

Quote: larryvc
I can't answer your second question, but I will give you some advice.  If you had posted the code you were using to set up the DAC we would have been able to answer your first problem much sooner.  When you only post a snippet of code, we can only assume that you know what you are doing and that you know that the problem is only with that snippet of code.  In this case it was not.  It was a setup problem in the CTRL register.

So to get better help with your second question post the code that you are using.


thank you for advice
and i add code for this new question.

Quote: h.lotfi
Hi,
today again i work with my sample and finally my problem solved 
my problem was third bit of CTRL register... i wasn't set it!!!

but i have just a question,
when i use DAC i can see result on pin number 8 in LQFP208 package or Pin Number E3 in LBGA256 package without set any register for this pin.
and when i add this line to my program "LPC_SCU->ENAIO2 |=1;" i can see result on P4.4 and on Pin number 8 in LQFP208 package in same time.
pin number 8 in package LQFP208 is share between ADC0_0, ADC1_0 and DAC.
when i write a sample code for ADC0_0 i use this pin as ADC0_0 without set any register for this pin.
my question is if i want write a sample code with ADC0_0 and DAC, What's happen for pin number 8?
my code:
void ADC_Configuration(void)
{
 // Init ADC0: 200 kHz sampling rate, 10 bits
        ADC_Init(LPC_ADC0, 200000, 10);
ADC_IntConfig(LPC_ADC0, ADC_ADINTEN0, DISABLE); // global interrupt is enabled by default

// Enable channel 0
ADC_ChannelCmd(LPC_ADC0, ADC_CHANNEL_0, ENABLE);
}
void DAC_Configuration(void)
{
DAC_CONVERTER_CFG_Type DacConfiStruct;
//**********
DacConfiStruct.CNT_ENA=ENABLE;
DacConfiStruct.DMA_ENA= ENABLE;  // Enable DMA and DAC
DAC_Init(LPC_DAC);
DAC_SetDMATimeOut(LPC_DAC,0xFFFF);
DAC_SetBias(LPC_DAC,DAC_MAX_CURRENT_700uA);
DAC_ConfigDAConverterControl (LPC_DAC,&DacConfiStruct);
//*****
}

Can i select the function for this pin?
for example can i use P4_4 as DAC and Pin number 8 as ADC0_0?



0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Mon Dec 22 14:24:23 MST 2014
I can't answer your second question, but I will give you some advice.  If you had posted the code you were using to set up the DAC we would have been able to answer your first problem much sooner.  When you only post a snippet of code, we can only assume that you know what you are doing and that you know that the problem is only with that snippet of code.  In this case it was not.  It was a setup problem in the CTRL register.

So to get better help with your second question post the code that you are using.
0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by h.lotfi on Mon Dec 22 10:05:19 MST 2014
Hi,
today again i work with my sample and finally my problem solved  :)
my problem was third bit of CTRL register... i wasn't set it!!!

but i have just a question,
when i use DAC i can see result on pin number 8 in LQFP208 package or Pin Number E3 in LBGA256 package without set any register for this pin.
and when i add this line to my program "LPC_SCU->ENAIO2 |=1;" i can see result on P4.4 and on Pin number 8 in LQFP208 package in same time.
pin number 8 in package LQFP208 is share between ADC0_0, ADC1_0 and DAC.
when i write a sample code for ADC0_0 i use this pin as ADC0_0 without set any register for this pin.
my question is if i want write a sample code with ADC0_0 and DAC, What's happen for pin number 8?
Can i select the function for this pin?
for example can i use P4_4 as DAC and Pin number 8 as ADC0_0?
0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Mon Dec 15 18:52:36 MST 2014

Quote: h.lotfi
but it doesn't work...



Explain what doesn't work means.  Do you get an error message?

LPC_SCU->ENAIO[2] |= (1<<0);


or just

LPC_SCU->ENAIO[2] |= 1;
   ^-- This was in the LPCOpen example software that nerd herd pointed you to.

/**
 * @briefDAC Pin Configuration
 * @returnNothing
 */
STATIC INLINE void Chip_SCU_DAC_Analog_Config(void)
{
/*Enable analog function DAC on pin P4_4*/
LPC_SCU->ENAIO[2] |= 1;
}


0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Mon Dec 15 02:44:34 MST 2014

Quote: h.lotfi

thank you for answer,
i Read this chapter!
these sections are for pins that share between analog and digital!
i want use pins are just Analog (pin number 8 in LQFP208 or Pin Number E3 in LBGA256)

and i told i write this line:
LPC_SCU->ENAIO2 |=(1<<0);
for P4_4 as DAC but it doesn't work...
do i write wrong?



You cannot just write what you wrote.  Like nerd herd said, there are other things that need to be set up first.  Did you even look at the links that he gave you?

You need to read both of these sections very carefully:

UM10503 chapter 16 section 16.4.6 ADC0 function select register
UM10503 chapter 16 section 16.4.8 Analog function select register

They tell you all the steps that need to be taken in setting up exactly what you want.  Follow all the steps and it will work.
0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by h.lotfi on Mon Dec 15 01:07:18 MST 2014

Quote: larryvc

Quote: h.lotfi
i want use pin number 8 (in LQFP208 Package), this pin share with ADC0_0 ,ADC1_0, DAC
How can i selec ADC1_0 or DAC Mode in this pin?



UM10503 chapter 16 section 16.4.6 ADC0 function select register


Quote: h.lotfi
and when i want use DAC in P4_4 pin ,i just add this line:
LPC_SCU->ENAIO2 |=(1<<0);

but this pin also doesn't work...



UM10503 chapter 16 section 16.4.8 Analog function select register



thank you for answer,
i Read this chapter!
these sections are for pins that share between analog and digital!
i want use pins are just Analog (pin number 8 in LQFP208 or Pin Number E3 in LBGA256)

and i told i write this line:
LPC_SCU->ENAIO2 |=(1<<0);
for P4_4 as DAC but it doesn't work...
do i write wrong?
0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Mon Dec 15 00:00:00 MST 2014

Quote: h.lotfi
i want use pin number 8 (in LQFP208 Package), this pin share with ADC0_0 ,ADC1_0, DAC
How can i selec ADC1_0 or DAC Mode in this pin?



UM10503 chapter 16 section 16.4.6 ADC0 function select register


Quote: h.lotfi
and when i want use DAC in P4_4 pin ,i just add this line:
LPC_SCU->ENAIO2 |=(1<<0);

but this pin also doesn't work...



UM10503 chapter 16 section 16.4.8 Analog function select register
0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by h.lotfi on Sun Dec 14 04:18:50 MST 2014

Quote: nerd herd
Hi h.lotfi,

There is configuration needed in order to use the DAC on the LPC4357. Have you read the user's maunal or looked at our LPCOpen software platform for a DAC software example?

Link to user's manual:
http://www.nxp.com/documents/user_manual/UM10503.pdf

LPCOpen software platform:
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc43xx-packages



Hi nerd herd,
i read user manual, but i can't find configuration in user manual!!!
which page is your mean?

and so i look LPCOpen Software... but it doesn't help me...
i work with DAC in LPC1788,
in LPC4357 i don't know how select pin for DAC, can you tell me how select pins for DAC?


Quote: h.lotfi

i want use pin number 8 (in LQFP208 Package), this pin share with ADC0_0 ,ADC1_0, DAC
How can i selec ADC1_0 or DAC Mode in this pin?

and when i want use DAC in P4_4 pin ,i just add this line:
LPC_SCU->ENAIO2 |=(1<<0);

but this pin also doesn't work...

0 Kudos
Reply

2,497 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Fri Dec 12 16:59:08 MST 2014
Hi h.lotfi,

There is configuration needed in order to use the DAC on the LPC4357. Have you read the user's maunal or looked at our LPCOpen software platform for a DAC software example?

Link to user's manual:
http://www.nxp.com/documents/user_manual/UM10503.pdf

LPCOpen software platform:
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc43xx-packages
0 Kudos
Reply