AnsweredAssumed Answered

DMA With minor loops

Question asked by David XY Zhou on May 11, 2016
Latest reply on May 11, 2016 by Hui_Ma

Hi,

I have K60 Tower board: TWRK60F120MUM

I have DMA transfer 2 bytes for each external trigger (from PORT B input)

  ChnInit1.TCD.DMA_TCD_SADDR_Reg     = DMA_SADDR_SADDR((void*)&FTM1_CNT) ; 

  ChnInit1.TCD.DMA_TCD_SOFF_Reg        = 0x0;     //Source address increment: no increment needed

  ChnInit1.TCD.DMA_TCD_SLAST_Reg    = 0;     //Source address reload after major loop finishes: no reload needed

  ChnInit1.TCD.DMA_TCD_ATTR_Reg        = DMA_ATTR_SSIZE(1) | DMA_ATTR_DSIZE(1) ;

 

  // destination configuration

  ChnInit1.TCD.DMA_TCD_DADDR_Reg    = DMA_DADDR_DADDR((void*)UserDataPtr);//&gdwDummyDA    

  ChnInit1.TCD.DMA_TCD_DOFF_Reg     = 0x0;

  ChnInit1.TCD.DMA_TCD_DLASTSGA_Reg    = 0;  //in Bytes : reload after major loop finishes

  // set CITER and BITER to maximum value

  ChnInit1.TCD.DMA_TCD_BITER_Reg       = DMA_BITER_ELINKNO_BITER_MASK;

  ChnInit1.TCD.DMA_TCD_CITER_Reg       = DMA_CITER_ELINKNO_CITER_MASK;

  ChnInit1.TCD.DMA_TCD_NBYTES_Reg      = 2;

  // enable auto close request

    ChnInit1.TCD.DMA_TCD_CSR_Reg      = 0;                                    //disale ELINK

//    ChnInit1.TCD.DMA_TCD_CSR_Reg      |= DMA_CSR_DREQ_MASK;                                     

 

It works.

 

But I want to transfer 8 bytes for each trigger, changed CNT to SC. and I make the following modifications:

  ChnInit1.TCD.DMA_TCD_SADDR_Reg     = DMA_SADDR_SADDR((void*)&FTM1_SC) ; 

  ChnInit1.TCD.DMA_TCD_SOFF_Reg        = 0x4;     //Source address increment: no increment needed

  ChnInit1.TCD.DMA_TCD_SLAST_Reg    = 0;     //Source address reload after major loop finishes: no reload needed

  ChnInit1.TCD.DMA_TCD_ATTR_Reg        = DMA_ATTR_SSIZE(2) | DMA_ATTR_DSIZE(2) | DMA_ATTR_DMOD(8) | DMA_ATTR_SMOD(8) ;

 

  // destination configuration

  ChnInit1.TCD.DMA_TCD_DADDR_Reg    = DMA_DADDR_DADDR((void*)UserDataPtr);//&gdwDummyDA    

  ChnInit1.TCD.DMA_TCD_DOFF_Reg     = 0x4;

  ChnInit1.TCD.DMA_TCD_DLASTSGA_Reg    = 0;  //in Bytes : reload after major loop finishes

  // set CITER and BITER to maximum value

  ChnInit1.TCD.DMA_TCD_BITER_Reg       = DMA_BITER_ELINKNO_BITER_MASK;

  ChnInit1.TCD.DMA_TCD_CITER_Reg       = DMA_CITER_ELINKNO_CITER_MASK;

  ChnInit1.TCD.DMA_TCD_NBYTES_Reg      = 8;

  // enable auto close request

    ChnInit1.TCD.DMA_TCD_CSR_Reg      = 0;                                    //disale ELINK

//    ChnInit1.TCD.DMA_TCD_CSR_Reg      |= DMA_CSR_DREQ_MASK;                                     

 

It only transfer once (8 Bytes). It doesn't continuously transfer with each trigger.

Suppose NBYTES=8 is minor loop. Why it only transfer once (8 bytes)?

 

Thank you,

david Zhou

Outcomes