AnsweredAssumed Answered

Why the DMA channel can't acheive the number ruled by the EDMA.TCD[channel].CITER

Question asked by Chen Xiaolei on Nov 1, 2017
Latest reply on Jan 7, 2018 by Chen Xiaolei

the  procedure:

#include "mpc563m.h" /* Use proper include file such as mpc5510.h or mpc5554.h */

const uint8_t SourceData0[] = {"Hello World Hello WorlH\r"}; /* Source data string */

 

uint32_t SourceData[24] ;
const uint8_t Destination = 8;
uint8_t aestination = 0; /* Destination byte */


void initTCD27(void) {

int32_t i;
for(i=0;i<24;i++)
{
SourceData[i]=SourceData0[i];
}

EDMA.TCD[27].SADDR = (vuint32_t) &SourceData0; /* Load address of source data */
EDMA.TCD[27].SSIZE = 0; /* Read 2**0 = 1 byte per transfer */
EDMA.TCD[27].SOFF = 1; /* After transfer, add 1 to src addr*/
EDMA.TCD[27].SLAST = -24; /* After major loop, reset src addr*/
EDMA.TCD[27].SMOD = 0; /* Source modulo feature not used */

EDMA.TCD[27].DADDR = (vuint32_t) (0xc3fc8150+0x00000003); //&Destination; /* Load address of destination */
EDMA.TCD[27].DSIZE = 0; /* Write 2**0 = 1 byte per transfer */
EDMA.TCD[27].DOFF = 0; /* Do not increment destination addr */
EDMA.TCD[27].DLAST_SGA = 0; /* After major loop, no dest addr change*/
EDMA.TCD[27].DMOD = 0; /* Destination modulo feature not used */

EDMA.TCD[27].NBYTES = 1; /* Transfer 1 byte per minor loop */
EDMA.TCD[27].BITER = 0x8018; /* 12 minor loop iterations */
EDMA.TCD[27].CITER = 0x8018; /* Initialize current iteraction count */
EDMA.TCD[27].D_REQ = 1; /* Disable channel when major loop is done*/
EDMA.TCD[27].INT_HALF = 0; /* Interrupts are not used */
EDMA.TCD[27].INT_MAJ = 0;
EDMA.TCD[27].CITERE_LINK = 1; /* Linking is not used */
EDMA.TCD[27].BITERE_LINK = 1;
EDMA.TCD[27].MAJORE_LINK = 0; /* Dynamic program is not used */
EDMA.TCD[27].E_SG = 0;
EDMA.TCD[27].BWC = 0; /* Default bandwidth control- no stalls */
EDMA.TCD[27].START = 0; /* Initialize status flags */
EDMA.TCD[27].DONE = 0;
EDMA.TCD[27].ACTIVE = 0;
EDMA.SSBR.R = 27;
}


void initTCD0(void) {

EDMA.TCD[0].SADDR = (vuint32_t) &Destination ; /* Load address of source data */
EDMA.TCD[0].SSIZE = 0; /* Read 2**0 = 1 byte per transfer */
EDMA.TCD[0].SOFF = 0; /* After transfer, add 1 to src addr*/
EDMA.TCD[0].SLAST = 0; /* After major loop, reset src addr*/
EDMA.TCD[0].SMOD = 0; /* Source modulo feature not used */

EDMA.TCD[0].DADDR = (vuint32_t) &aestination; //&Destination; /* Load address of destination */
EDMA.TCD[0].DSIZE = 0; /* Write 2**0 = 1 byte per transfer */
EDMA.TCD[0].DOFF = 0; /* Do not increment destination addr */
EDMA.TCD[0].DLAST_SGA = 0; /* After major loop, no dest addr change*/
EDMA.TCD[0].DMOD = 0; /* Destination modulo feature not used */

EDMA.TCD[0].NBYTES = 1; /* Transfer 1 byte per minor loop */
EDMA.TCD[0].BITER = 1; /* 12 minor loop iterations */
EDMA.TCD[0].CITER = 1; /* Initialize current iteraction count */
EDMA.TCD[0].D_REQ = 1; /* Disable channel when major loop is done*/
EDMA.TCD[0].INT_HALF = 0; /* Interrupts are not used */
EDMA.TCD[0].INT_MAJ = 0;
EDMA.TCD[0].CITERE_LINK = 0; /* Linking is not used */
EDMA.TCD[0].BITERE_LINK = 0;
EDMA.TCD[0].MAJORE_LINK = 1;
EDMA.TCD[0].MAJORLINKCH = 27;
/* Dynamic program is not used */
EDMA.TCD[0].E_SG = 0;
EDMA.TCD[0].BWC = 0; /* Default bandwidth control- no stalls */
EDMA.TCD[0].START = 0; /* Initialize status flags */
EDMA.TCD[0].DONE = 0;
EDMA.TCD[0].ACTIVE = 0;
// EDMA.SSBR.R = 0;
}
void main (void) {
volatile uint32_t i = 0; /* Dummy idle counter */
int32_t j1,j2,j3,j4;

initTCD27(); /* Initialize DMA Transfer Control Descriptor 0 */
initTCD0();

EDMA.CR.R = 0x0000E400; /* Use fixed priority arbitration for DMA groups and channels */
//EDMA.CPR[0].R = 0x0; /* Channel 0 priorites: group priority = 0, channel priority = 0 */

EDMA.SERQR.R =65; /* Enable EDMA channel 0 */
// EDMA.SERQR.R = 0; /* Enable EDMA channel 0 */

EDMA.SSBR.R = 27; /* Set channel 0 START bit to initiate first minor loop transfer */

/* Initate DMA service using software */
// while (EDMA.TCD[27].CITER != 1) { /* while not on last minor loop */
/* wait for START=0 and ACTIVE=0 */
// while ((EDMA.TCD[27].START == 1) | (EDMA.TCD[27].ACTIVE == 1)) {}
j1= *(int32_t *)(vuint32_t) 0xc3fc8150;
//j1=j1>>24;
j2=EDMA.TCD[27].CITER;
j3=* &aestination;
// EDMA.SSBR.R = 27; /* Set channel 0 START bit again for next minor loop transfer */
// }

while (1) { i++; } /* Loop forever */
}

 

the channel 0 have worked. But the j2 which Just run as the 0x00000011,and the the procedure has runned the end. I don't understand why?Thank you for your help.

Outcomes