lpcware

LPC4370 DAC problem

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mshrestha789 on Wed Aug 20 19:32:12 MST 2014
Hello friends,

I am trying to implement DAC of LPC4370. I have LPC-link 2 board. I am trying to use EXP_ADC0_DAC for DAC. I have tried some methods but with out any success. Here's DAC part of the code


void dac_init(void){

/*Tri-state the output driver by selecting an input -> added after reading user manual pg 409*/
Chip_SCU_PinMuxSet(4,4,SCU_MODE_FUNC0);
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 2, 4); // set GPIO port direction register
Chip_SCU_PinMuxSet(4,4,SCU_MODE_INACT); // disable pull up and pull down resistor
LPC_SCU->SFSP[4][4] &= ~(1<<6);//disable receiveing by setting the EZI bit to zero.

Chip_SCU_DAC_Analog_Config(); //select DAC function
Chip_DAC_Init(LPC_DAC); //initialize DAC
Chip_DAC_SetDMATimeOut(LPC_DAC, 0xFFFF);
Chip_DAC_ConfigDAConverterControl(LPC_DAC, (DAC_CNT_ENA | DAC_DMA_ENA));
}
void DACTask1(void) {
static uint32_t tmp = 0;
uint32_t i = 0;
while (1) {
tmp++;
if (tmp == DATA_SIZE)) {
tmp = 0;
}
Chip_DAC_UpdateValue(LPC_DAC, sine_wave[tmp]); //update DAC value
while (!(Chip_DAC_GetIntStatus(LPC_DAC))) {}
for(i = 0; i < 10000; i++);
}
}



The code is not working. Did I miss any thing? Please help me regarding this.

Outcomes