AnsweredAssumed Answered

ADuCM360 DAC DMA + Timer1

Question asked by dezna on Apr 8, 2014
Latest reply on Apr 17, 2014 by dezna

hello!

can not start clocking (triggering) DAC DMA from TIMER1.

separately they work, but when i set DACCON(5) nothing happens.

sample working code:

 

#define DMA_DAC_B  8

DmaDesc dmaChanDesc[CCD_SIZE * 2]

uint32_t dac_buf[100];

uint32_t DmaCtrlCfgVal;

 

void DACDMA_Init(void){

     CLKDIS &= ~(CLKDIS_DISDMACLK | CLKDIS_DIST1CLK | CLKDIS_DISDACCLK);

     DACCON = /*DACCON_CLK_Timer1 |*/ DACCON_CLR | DACCON_RNG_IntVref | DACCON_MDE_12bit;

     DACCON |= DACCON_DMAEN;

    

     memset(dmaChanDesc,0x0,sizeof(dmaChanDesc));

     DMAPDBPTR = (uint32_t)&dmaChanDesc;

     DMACFG = 1;

     DMAENSET = 1<<DMA_DAC_B;

     DMAPRISET = 1<<DMA_DAC_B;

     DMARMSKCLR = 1<<DMA_DAC_B;

     dmaChanDesc[DMA_DAC_B].srcEndPtr = (uint32_t)(dac_buf + 100 - 1);

     dmaChanDesc[DMA_DAC_B].destEndPtr = (uint32_t)&DACDAT;

     DmaCtrlCfgVal = dmaChanDesc[DMA_DAC_B].ctrlCfgVal =
        ((uint32_t)3<<30) | //destination no increment adress
        (2<<26) | //source increment word
        (2<<24) | //size of source data. 2 = word
        ((100 - 1) << 4) | //number transmit
        1; //basic
    NVIC_EnableIRQ(DMA_DAC_IRQn);
    NVIC_SetPriority(DMA_DAC_IRQn,0)

 

     T1LD = 0x10;

     T1CON = T1CON_ENABLE | T1CON_CLK_UCLK | T1CON_MOD_PERIODIC;

     NVIC_EnableIRQ(TIMER1_IRQn);

}

 

uint32_t *adr_dmaChanCtrl = &dmaChanDesc[DMA_DAC_B].ctrlCfgVal;

void DMA_DAC_IRQHandler(void){
    *adr_dmaChanCtrl = DmaCtrlCfgVal;
    DMAENSET = 1<<DMA_DAC_B;       
}

 

void DMA_ERR_IRQHandler(void){
    DMAERRCLR = 1;
}

 

void TIMER1_IRQHandler(void){

     toggle pin

}

 

what am I doing wrong?

Outcomes