AnsweredAssumed Answered

PDB - ADC - DMA

Question asked by mrandreas on Sep 9, 2014
Latest reply on Sep 17, 2014 by mrandreas

Hello,

 

I'm using the PDB with the differential channel on ADC with the K serie and keil IDE. I'm trying to go from using the adc irq to using the DMA buffer the adc data without success.

 

I've disabled the ADC_SC1_AIEN (irq) and enabled the ADC_SC2_DMAEN

 

DMA configuration:

 

SIM->SCGC7 |= (uint32_t)SIM_SCGC7_DMA_MASK ;

  SIM->SCGC6 |= (uint32_t)SIM_SCGC6_DMAMUX0_MASK;

  DMA0->CR = DMA_CR_GRP0PRI(3) | DMA_CR_GRP1PRI(3);

  DMA0->CR |= (uint32_t) (DMA_CR_EMLM_MASK);

  /* DMA_EEI: EEI0=0 */

  DMA0->EEI &= (uint32_t)~(uint32_t)(DMA_EEI_EEI0_MASK);

  DMA0->INT = DMA_INT_INT0_MASK;       // clear interrupt

 

DMAMUX0->CHCFG[0]           = DMAMUX_CHCFG_ENBL_MASK|DMAMUX_CHCFG_SOURCE(41);   //DMA source ADC 

  DMA0->TCD[0].SADDR          = (uint32_t) &ADC1->R[0]; //                           

  DMA0->TCD[0].SOFF           = 0x00;                                              

  DMA0->TCD[0].SLAST          = 0x00;                                              

  DMA0->TCD[0].DADDR          = (uint32_t) &destinationAdr[0];      

  DMA0->TCD[0].DOFF           = 0x02;                                              

  DMA0->TCD[0].NBYTES_MLNO    = 0x02;                                    

  DMA0->TCD[0].DLAST_SGA      = -(destinationSize); //32 byte aligned

DMA0->TCD[0].NBYTES_MLOFFNO = DMA_NBYTES_MLOFFNO_NBYTES(2) ;

DMA0->TCD[0].ATTR           = DMA_ATTR_SSIZE(1)|DMA_ATTR_DSIZE(1);

DMA0->TCD[0].CSR            = DMA_CSR_INTMAJOR_MASK;

NVIC_EnableIRQ(DMA0_DMA16_IRQn); 

 

What am I missing out?

 

thanks

A

Outcomes