AnsweredAssumed Answered

DMA Issue in MPC57xx

Question asked by Meedan Deys on Mar 23, 2016
Latest reply on Mar 25, 2016 by Meedan Deys

Hello Folks,

I am working on the DMA driver for MPC5744P. I am facing below issue, any direction/thoughts on this would be of great help.

 

I have set up my DMA TCDs to transfer data in RAM from Buffer1 to Buffer2. When I initiate DMA transfer, I observe DMA engine stops after 1 iteration of major loop . There were no errors reported in the DMA Error Status register. Below are my TCD configurations.

 

Note: when when i change my Minor loop to n bytes and Major loop = 1, then DMA works fine.

For some reason my Major loop does not run for more than 1 iteration. Any thoughts on this would be of great help

 

Below is code which i am trying out

 

#define BUFFER_LEN 12

const unsigned char Buffer1[BUFFER_LEN] = "Hello World"

unsigned char Buffer2[BUFFER_LEN];

 

void edma_config()

{  

  DMA_0.TCD[1].SADDR.R = (unsigned long)&Buffer1;               /* Load address of source data and adjust for size */

  DMA_0.TCD[1].ATTR.B.SSIZE = 0;                                /* Read 2**0 = 1 byte per transfer */

  DMA_0.TCD[1].ATTR.B.SMOD = 0;                                 /* Source modulo feature not used  */

  DMA_0.TCD[1].SOFF.R = 1;                                      /* After transfer, add 0 to src addr */

  DMA_0.TCD[1].SLAST.R = 0;                                     /* After major loop, adjust the source address  */

 

 

  DMA_0.TCD[1].DADDR.R = (unsigned long)&Buffer2;

  DMA_0.TCD[1].ATTR.B.DSIZE = 0;                                /* Write 2**0 = 1 byte per transfer  */

  DMA_0.TCD[1].ATTR.B.DMOD = 0;                                 /* Destination modulo feature not used  */

  DMA_0.TCD[1].DOFF.R = 1;                                      /* Increment destination addr by 1 */

 

  /* If you are executing more than one time, you need to subtract NUMBER_OF_BYTES here instead of 0 */

  DMA_0.TCD[1].DLASTSGA.R = 0;                                  /* After major loop, adjust the destination address */

 

 

  /* If you want to keep going, set this to 0 to keep the channel enabled */

  DMA_0.TCD[1].CSR.B.DREQ = 1;                                  /* Disable channel when major loop is done*/

 

  DMA_0.TCD[1].NBYTES.MLNO.R = 1;                               /* NBYTES - Transfer 1 byte per minor loop */

  DMA_0.TCD[1].CITER.ELINKNO.B.CITER = BUFFER_LEN;              /* Init. current interaction count */

  DMA_0.TCD[1].BITER.ELINKNO.B.BITER = BUFFER_LEN;              /* Minor loop iterations */

 

 

  /* RM reccomendations end here */

  DMA_0.TCD[1].CITER.ELINKNO.B.ELINK = 0;                       /* No Enabling channel LINKing */

  DMA_0.TCD[1].BITER.ELINKNO.B.ELINK = 0;                       /* No Enabling channel LINKing */

  DMA_0.TCD[1].CSR.B.MAJORELINK = 0;                            /* Dynamic program is not used */

  DMA_0.TCD[1].CSR.B.ESG = 0;                                   /* Scatter Gather not Enabled */

  DMA_0.TCD[1].CSR.B.BWC = 0;                                   /* Default bandwidth control- no stalls */

  DMA_0.TCD[1].CSR.B.INTHALF = 0;                               /* No interrupt when major count half complete */

  DMA_0.TCD[1].CSR.B.INTMAJOR = 0;                              /* No interrupt when major count completes */

  DMA_0.TCD[1].CSR.B.MAJORLINKCH = 0;                           /* No link channel # used */

  DMA_0.TCD[1].CSR.B.DONE = 0;

  DMA_0.TCD[1].CSR.B.ACTIVE = 0;

  DMA_0.TCD[1].CSR.B.START = 1;                                 /* Initialize status flags START, DONE, ACTIVE */

}

Outcomes