LB Singh

MCF52259 CW7.1 DMA transfer problem

Discussion created by LB Singh on Jul 5, 2012

Hi!

I am trying to transfer data from one variable (or array/ADC) to another variable/array via DMA. Tried various combination, but not able to solve it.

I have attached the project too.

 

Here is one of the configuration what I tried. 

\Cpu.c

void PE_low_level_init(void)

{

  /* MPARK: BCR24BIT=0 */

  clrReg32Bits(MPARK, 0x01000000UL);   

  /* DMAREQC: DMAC3=7,DMAC2=6,DMAC1=5,DMAC0=4 */

  clrSetReg32Bits(DMAREQC, 0x89ABUL, 0x7654UL);

  /* MPARK: M2_P_EN=1,M3_PRTY=3,M2_PRTY=2,M0_PRTY=0,M1_PRTY=1,FIXED=0,TIMEOUT=0,PRKLAST=0,LCKOUT_TIME=9 */

  clrSetReg32Bits(MPARK, 0x001E7600UL, 0x02E10900UL);

  /* MPR: MPR=5 */

  clrSetReg8Bits(MPR, 0x0A, 0x05);     

  }

 

//Configured from PE

void init_tmr_dma0_Init(void)

{

  /* DTMR0: PS=0xF9,CE=0,OM=0,ORRI=0,FRR=0,CLK=2,RST=0 */

  setReg16(DTMR0, 0xF904U);            

  /* DTRR0: REF=0x5F5E */

  setReg32(DTRR0, 0x5F5EUL);           

  /* DTXMR0: DMAEN=0,HALTED=1,??=0,??=0,??=0,??=0,??=0,MODE16=0 */

  setReg8(DTXMR0, 0x40);               

  /* DTER0: ??=0,??=0,??=0,??=0,??=0,??=0,REF=1,CAP=1 */

  setReg8(DTER0, 0x03);                

  /* DTMR0: RST=1 */

  setReg16Bits(DTMR0, 0x01U);          

}

 

 

//Configured from PE

\Vector.c

  isr_dma0_done,                       /* 0x49  VBR+0x00000124   4   0   ivINT_DMA0_DONE            used by PE */

 

//Variable decleration:

UINT16 dma0_in_buff = 5;

UINT16 dma1_in_buff = 0;

 

//Function called from main

void an_init_dma0(void)

{

                SAR0 = (UINT16)&dma0_in_buff;

                DAR0 = (UINT16)&dma1_in_buff;

               

                DSR0 = DSR0_DONE_BITMASK;

                BCR0 = 2;

                DCR0 = DCR0_INT_BITMASK | DCR0_AA_BITMASK | DCR0_START_BITMASK |

                                   (0 << DCR0_SMOD0_BITMASK) | (0 << DCR0_DMOD0_BITMASK) |

                                   (2 << DCR0_SSIZE0_BITMASK) | (2 << DCR0_DSIZE0_BITMASK);

}

 

//DMA ISR

__declspec(interrupt) void isr_dma0_done(void)

{

               //In case of BCR = 0

                if(testReg32Bits(DSR0, DSR0_DONE_BITMASK))

                {

                                setReg32(DSR0, DSR0_DONE_BITMASK);

                                BCR0 = 2;

                                DCR0 |= DCR0_START_BITMASK;

                }

}

 

Anyone can please let me know where is the miss.

 

Br,

LB

Outcomes