lpcware

LPCxpreso 1769 DAC-DMA register error

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by RawthiL on Tue Sep 20 12:15:04 MST 2011
Hello, Im having problems with my LPCxpreso 1769, I can configure the DAC with DMA and it works just fine at 1KHz and 1000 samples, with this code:
void configuracion_signal(void)
{
    PINSEL_CFG_Type     PinCfg_AOUT;                               
    DAC_CONVERTER_CFG_Type DAC_Struct;                               
    GPDMA_LLI_Type DMA_LLI_Struct;                                   

    PinCfg_AOUT.Funcnum = 2;   
        PinCfg_AOUT.OpenDrain = 0;
        PinCfg_AOUT.Pinmode = 0;                                       
        PinCfg_AOUT.Pinnum = 26;                                       
        PinCfg_AOUT.Portnum = 0;                                       

    PINSEL_ConfigPin(&PinCfg_AOUT);


    for(i=0;i<definicion;i++)                    //This make the DMA vector, I ereased some lines to make it shoter (nothing to do with config)
    {
        if (i<250)tabla_dac= tabla+offset;
        else if (i<500)tabla_dac=offset+tabla[499-i];
        else if (i<750)tabla_dac=offset-tabla[i-500];
        else tabla_dac=offset-tabla[1000-i];

        tabla_dac = tabla_dac*amplitud;                       
        tabla_dac = (tabla_dac<<6);                           

    }

    DMA_LLI_Struct.SrcAddr= (uint32_t)tabla_dac;                   
    DMA_LLI_Struct.DstAddr= (uint32_t)&(LPC_DAC->DACR);               
    DMA_LLI_Struct.NextLLI= (uint32_t)&DMA_LLI_Struct;               
    DMA_LLI_Struct.Control= DMA_size
                            | (2<<18)        
                            | (2<<21)        
                            | (1<<26)        
                            ;
    GPDMA_Init();   

    GPDMACfg.ChannelNum = 0;           
    GPDMACfg.SrcMemAddr = (uint32_t)(tabla_dac);   
    GPDMACfg.DstMemAddr = 0;           
    GPDMACfg.TransferSize = DMA_size;       
    GPDMACfg.TransferWidth = 0;           
    GPDMACfg.TransferType = GPDMA_TRANSFERTYPE_M2P;   
    GPDMACfg.SrcConn = 0;                   
    GPDMACfg.DstConn = GPDMA_CONN_DAC;           
    GPDMACfg.DMALLI = (uint32_t)&DMA_LLI_Struct;       
    GPDMA_Setup(&GPDMACfg);


    DAC_Struct.CNT_ENA =SET;   
    DAC_Struct.DMA_ENA = SET;   

    DAC_Init(LPC_DAC);       


    tmp = (CLOCK_DAC_MHZ*1000000)/(frecuencia*definicion);
                               
                               
    DAC_SetDMATimeOut(LPC_DAC,tmp);               
    DAC_ConfigDAConverterControl(LPC_DAC, &DAC_Struct);   


    GPDMA_ChannelCmd(0, ENABLE);               
}
The problem is that when I try to send something via UART or even set a bit with GPIO the DAC shuts down.
The register value of DACCTRL changes from 0x0C to 0x0D, so, the  INT_DMA_REQ (as I suppose from reading the manual of the LPC1769) changes, but I see no reason for this to happen, and this happens with a lot more functions than UART and GPIO.
DACR changes too but I think that's because the DMA.

So, why is it happening? or how can I make it work despite of what I'm doing in the system core or other peripherals?

Thanks in advance!

Outcomes