<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help initializing DAC on the LPC4337 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Help-initializing-DAC-on-the-LPC4337/m-p/881389#M35257</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can't check the code which you are using, as I'm no longer active on this MCU platform, but there was a kind of magic setting for the DAC, see the snapshot of a thread from the past.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I have some problem with DAC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;After configuring using driver lpc43xx_dac and selecting analog function in ENAIO2 the E3 pin &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;(analog pin ADC0_0/ADC1_0/DAC in LPC4350FET256) remains stable and have 3.0V voltage level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;How do I configure DAC (from lpc43xx_dac driver):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;/* Set default clock divider for DAC */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;CGU_EntityConnect(CGU_CLKSRC_PLL1, CGU_BASE_APB3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;//Set maximum current output&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DAC_SetBias(LPC_DAC,DAC_MAX_CURRENT_700uA);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;//Select pin function - DAC&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;p-&amp;gt;ENAIO2 |= (1&amp;lt;&amp;lt;(0));// At that stage pin E3 goes to 3.0V&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;After configuring I am trying to set some voltages on the DAC output, but the voltage remains the same (3.0V).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;tmp = DACx-&amp;gt;CR &amp;amp; DAC_BIAS_EN;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;tmp |= DAC_VALUE(dac_value);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;// Update value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DACx-&amp;gt;CR = tmp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Looks like I have missed something.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I will kindly appreciate any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;=========================================================================================&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Is it correct, that you use FUNC8?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;scu_pinmux(0x4 ,4 , MD_PLN, FUNC8); // DAC is function 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I find only FUNC0 to FUNC7, no FUNC8 and according to user manual UM10503 page 292 (Rev 1.4 from Sep 2012) &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;the bit field MODE goes only from bit 0 to 2 and function 0 to 7?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Perhaps this is different in LPC18xx compared to LPC43xx?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;M.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;=========================================================================================&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Hi M.,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I'm sure that's a typo. It's the ninth entry in a list where your choice is one out of eight. Correct is FUNC0, &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;as that is the GPIO function, which you should make an input. As a matter of fact, the selection in the MODE field is only secondary. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;The choice for DAC in the ENAIO2 multiplex register gives DAC precedence over the digital function selected via MODE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;However, that fight is a sideshow...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;The original question wasn't for P4_4, to which those settings apply! Antony rather uses the ADC0_0/ADC1_0/DAC signal &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;(pin E3 of the LBGA256 package). For that pure analog pin the settings of the P4_4 config register and the ENAIO2 multiplexer are completely &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;irrelevant. Pin ADC0_0/ADC1_0/DAC will always show the DAC output as soon as the DAC is enabled.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;The missing point is probably the DMA_ENA bit in the DAC CTRL register. Despite its name this bit must be set to get a DAC output, &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;whether you use DMA or not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;R.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Edit: I should have mentioned that the existing library requires you to call DAC_ConfigDAConverterControl() in addition to &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DAC_Init() for the DAC to operate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;=========================================================================================&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Thanks for the information, but for a newbie like me, it takes hours to understand...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Let's make it easier:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;SystemInit();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;CGU_Init();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;scu_pinmux(0x4 ,4 , MD_PLN, 0); // set pin configuration register&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;GPIO_SetDir(0x4, 4, 0); // set GPIO port direction register&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;LPC_SCU-&amp;gt;ENAIO2 |= 1; // set analog function select register&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DAC_Init(LPC_DAC);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;LPC_DAC-&amp;gt;CTRL |= DAC_DMA_ENA;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;int32_t iLop;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;while(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;for (iLop = 0; iLop &amp;lt; 1023; iLop++)&amp;nbsp;&amp;nbsp; &amp;nbsp;DAC_UpdateValue(LPC_DAC, iLop);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;for (iLop = 1023; iLop &amp;gt; 0; iLop--)&amp;nbsp;&amp;nbsp; &amp;nbsp;DAC_UpdateValue(LPC_DAC, iLop);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;Bernhard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Mar 2019 08:56:37 GMT</pubDate>
    <dc:creator>bernhardfink</dc:creator>
    <dc:date>2019-03-22T08:56:37Z</dc:date>
    <item>
      <title>Help initializing DAC on the LPC4337</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Help-initializing-DAC-on-the-LPC4337/m-p/881388#M35256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to initialize the DAC on the LPC4337, I've read the DAC section of the manual and used the debugger to gain access of the DAC registers. I was able to "Enable" or set bit 3 of the CTRL register, set the CNTVAL register at 0x0000 and I put my 10 bit value in the CR register (15:6 bit) and my board does output the right analog voltage. However when I try to implement this in the code, it's not working. I don't see the CTRL bit 3 changing so I believe my initialization of the DAC isn't correct. I cannot find any documentation on this and all the examples I see either are gibberish or older/other IDEs. I'm using both LPCxpresso and MCUxpresso.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* p4_4 ADC0_0, GPIO 2_4*/&lt;BR /&gt; Chip_SCU_PinMuxSet(0x4,4,SCU_MODE_FUNC0);&lt;BR /&gt; Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 2, 4); // set GPIO port direction register&lt;BR /&gt; Chip_SCU_PinMuxSet(0x4,4,SCU_MODE_INACT); // disable pull up and pull down resistor&lt;BR /&gt; LPC_SCU-&amp;gt;SFSP[0x4][4] &amp;amp;= ~(1&amp;lt;&amp;lt;6);//disable receiveing by setting the EZI bit to zero.&lt;/P&gt;&lt;P&gt;Chip_SCU_DAC_Analog_Config(); //select DAC function&lt;BR /&gt; Chip_DAC_Init(LPC_DAC); //initialize DAC&lt;BR /&gt; Chip_DAC_SetDMATimeOut(LPC_DAC, 0x0000);&lt;BR /&gt; Chip_DAC_ConfigDAConverterControl(LPC_DAC, (DAC_DMA_ENA));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have also tried to do LPC_DAC -&amp;gt; to write the registers but that didn't work either. Any and all help will be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2019 05:15:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Help-initializing-DAC-on-the-LPC4337/m-p/881388#M35256</guid>
      <dc:creator>matthewmaslak</dc:creator>
      <dc:date>2019-03-22T05:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help initializing DAC on the LPC4337</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Help-initializing-DAC-on-the-LPC4337/m-p/881389#M35257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can't check the code which you are using, as I'm no longer active on this MCU platform, but there was a kind of magic setting for the DAC, see the snapshot of a thread from the past.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I have some problem with DAC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;After configuring using driver lpc43xx_dac and selecting analog function in ENAIO2 the E3 pin &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;(analog pin ADC0_0/ADC1_0/DAC in LPC4350FET256) remains stable and have 3.0V voltage level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;How do I configure DAC (from lpc43xx_dac driver):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;/* Set default clock divider for DAC */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;CGU_EntityConnect(CGU_CLKSRC_PLL1, CGU_BASE_APB3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;//Set maximum current output&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DAC_SetBias(LPC_DAC,DAC_MAX_CURRENT_700uA);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;//Select pin function - DAC&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;p-&amp;gt;ENAIO2 |= (1&amp;lt;&amp;lt;(0));// At that stage pin E3 goes to 3.0V&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;After configuring I am trying to set some voltages on the DAC output, but the voltage remains the same (3.0V).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;tmp = DACx-&amp;gt;CR &amp;amp; DAC_BIAS_EN;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;tmp |= DAC_VALUE(dac_value);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;// Update value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DACx-&amp;gt;CR = tmp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Looks like I have missed something.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I will kindly appreciate any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;=========================================================================================&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Is it correct, that you use FUNC8?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;scu_pinmux(0x4 ,4 , MD_PLN, FUNC8); // DAC is function 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I find only FUNC0 to FUNC7, no FUNC8 and according to user manual UM10503 page 292 (Rev 1.4 from Sep 2012) &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;the bit field MODE goes only from bit 0 to 2 and function 0 to 7?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Perhaps this is different in LPC18xx compared to LPC43xx?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;M.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;=========================================================================================&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Hi M.,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;I'm sure that's a typo. It's the ninth entry in a list where your choice is one out of eight. Correct is FUNC0, &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;as that is the GPIO function, which you should make an input. As a matter of fact, the selection in the MODE field is only secondary. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;The choice for DAC in the ENAIO2 multiplex register gives DAC precedence over the digital function selected via MODE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;However, that fight is a sideshow...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;The original question wasn't for P4_4, to which those settings apply! Antony rather uses the ADC0_0/ADC1_0/DAC signal &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;(pin E3 of the LBGA256 package). For that pure analog pin the settings of the P4_4 config register and the ENAIO2 multiplexer are completely &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;irrelevant. Pin ADC0_0/ADC1_0/DAC will always show the DAC output as soon as the DAC is enabled.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;The missing point is probably the DMA_ENA bit in the DAC CTRL register. Despite its name this bit must be set to get a DAC output, &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;whether you use DMA or not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;R.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Edit: I should have mentioned that the existing library requires you to call DAC_ConfigDAConverterControl() in addition to &lt;/SPAN&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DAC_Init() for the DAC to operate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;=========================================================================================&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Thanks for the information, but for a newbie like me, it takes hours to understand...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;Let's make it easier:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;SystemInit();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;CGU_Init();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;scu_pinmux(0x4 ,4 , MD_PLN, 0); // set pin configuration register&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;GPIO_SetDir(0x4, 4, 0); // set GPIO port direction register&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;LPC_SCU-&amp;gt;ENAIO2 |= 1; // set analog function select register&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;DAC_Init(LPC_DAC);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;LPC_DAC-&amp;gt;CTRL |= DAC_DMA_ENA;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;int32_t iLop;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;while(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;for (iLop = 0; iLop &amp;lt; 1023; iLop++)&amp;nbsp;&amp;nbsp; &amp;nbsp;DAC_UpdateValue(LPC_DAC, iLop);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;for (iLop = 1023; iLop &amp;gt; 0; iLop--)&amp;nbsp;&amp;nbsp; &amp;nbsp;DAC_UpdateValue(LPC_DAC, iLop);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: andale mono, monospace; font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;Bernhard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2019 08:56:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Help-initializing-DAC-on-the-LPC4337/m-p/881389#M35257</guid>
      <dc:creator>bernhardfink</dc:creator>
      <dc:date>2019-03-22T08:56:37Z</dc:date>
    </item>
  </channel>
</rss>

