AnsweredAssumed Answered

DMA Destination Offset Confusion

Question asked by Eduardo Umana on Jan 26, 2015
Latest reply on Jan 27, 2015 by Eduardo Umana

I am trying to implement DMA for receiving I2S channel 0 on a FRDM K22F. I got the I2S working and the I2S0_RDR0 register is updating with data; FIFO Request DMA is enabled. I am trying to store the data in an array 1024 long, each bin with 32 bits. That should be 4096 bytes. Here is my code

 

     SIM_SCGC6 |= 0x2;                      //DMAMUX Module Turn On   

    SIM_SCGC7 |= 0x2;                       //DMA Module Turn On

    DMAMUX_CHCFG0 = 0x8C;           //I2S Source: Slot 12 & Activate  

  

    DMA_TCD0_CSR &= 0xBF;            //Inactive

    NVIC_EnableIRQ(DMA0_IRQn);      //Enable IRQ DMA Channel 0

    DMA_CR = 0x80;                         //Enable Minor Looping 

      

    DMA_TCD0_SADDR = (uint32_t)&I2S0_RDR0;    //Data Source

    DMA_TCD0_DADDR = (uint32_t) BUFFER_A;      //Destination

  

    DMA_TCD0_SOFF = 0;                      //No Source Offset

    DMA_TCD0_SLAST = 0;                    //Nothing Added to Source Address after Major Loop

    DMA_TCD0_DLASTSGA = -4096;     //Value Added to Destination Address after Major Loop

    DMA_TCD0_DOFF = 4;                     //4 Byte Destination Offset

     

    //DMA_TCD0_NBYTES_MLOFFYES = 0x40001004; //DMLOE Set, MLOFF = 4 bytes, NBYTES = 4

  

    DMA_TCD0_NBYTES_MLNO = 4;         //4 Bytes Transfered in each Minor Loop

    DMA_TCD0_BITER_ELINKNO = 1024;   //1024 Bins 

    DMA_TCD0_CITER_ELINKNO = 1024;  //1024 Bins

    DMA_TCD0_ATTR = 0x202;                //32-Bit Transfer Size

    DMA_TCD0_CSR = 0x2;                      //Interrupt Major Iteration

  

    DMA_SERQ = 0x0;                              //Channel 0 Enable

    DMA_TCD0_CSR |= 0x41;                   //Enable!


Right now my code is crashing, I am not sure why but I do think it has to do with the minor loop offset. What is the difference between DOFF and using the NBYTES_MLOFFYES offset?

Outcomes