This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x EDMA destination address doesn't increment

I’m using EDMA to read the McSPI RX register and store in a global memory buffer and it works fine. To avoid initializing the ParamSet every transfer, I then set EDMA3CC_OPT_STATIC in the “opt” parameter and now the destination address no longer increments. I can determine this because only the first byte in the destination buffer gets updated and the value stored is the last byte received. This test transfer is very small (3 bytes) to make it easy to see on a scope/analyzer. What is going on?

 

EDMA3CCPaRAMEntry mSpiRxParamSet

 

static void InitSpiRxParamSet(uint32_t length)

{

   uint32_t opt;

 

   // Source is SPI Rx FIFO

   mSpiRxParamSet.srcAddr = (uint32_t)MCSPI_RX0_REG;

 

   // Destination is Rx buffer

   mSpiRxParamSet.destAddr = (uint32_t)gSpiMasterRxBuf;

   mSpiRxParamSet.aCnt = 1;   // 1 byte per event

   mSpiRxParamSet.bCnt = length;  // bCnt * cCnt = Total bytes

   mSpiRxParamSet.cCnt = 1;

 

   // Source is register so don't increment

   mSpiRxParamSet.srcBIdx = 0;

   mSpiRxParamSet.srcCIdx = 0;

 

   // Destination is memory so increment

   mSpiRxParamSet.destBIdx = 1;

   mSpiRxParamSet.destCIdx = 0;

 

   mSpiRxParamSet.linkAddr = 0xFFFF;    // No link

   mSpiRxParamSet.rsvd = 0;

 

   mSpiRxParamSet.bCntReload = 0;

 

   opt = 0;  // "A-synchronized" transfer (requires multiple “B” events)

   opt |= (EDMA3CC_OPT_STATIC);  // Causes destination to not increment

 

   // Flag to set in IPR/IPRH when transfer completes

   opt |= (EDMA_SPI_RX_CHAN << EDMA3CC_OPT_TCC_SHIFT);

 

   // Set IPR/IPRH only when entire transfer completes

   opt |= (1 << EDMA3CC_OPT_TCINTEN_SHIFT);

   mSpiRxParamSet.opt = opt;

 

   // Write ParamSet

   EDMA3SetPaRAM(SOC_EDMA30CC_0_REGS, EDMA_SPI_RX_CHAN, &mSpiRxParamSet);

 

   // Enable EDMA

   EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA_SPI_RX_CHAN, EDMA3_TRIG_MODE_EVENT);

}

  • if you are setting OPT STATIC field to 1, no increment in any PaRAM field is  the right/intended behavior.

    From the OPT register field description

    The PaRAM set is not updated or linked after a TR is submitted. A value of 1 should be used for isolated QDMA transfers or for the final transfer in a linked list of QDMA transfers.

    You can also find this further explained in Table 11-9 pg 1541 of the TRM 

  • This is Starterware, CCS6.

    Why does the exact same ParamSet work with OPT STATIC cleared? STATIC simply means the ParamSet doesn't get updated when submitted but all other behaviors should be the same.

    What field(s) in my ParamSet do you recommend I change to get the desired behavior? I presently set DAM to 0 which means destination increment. I also set DSTBINDX to 1. Keep in mind this works properly with STATIC cleared.
  • If the problem you are trying to solve is to not have to reinitialize the same transfer context after your events worth 3 bytes have expired and each RX event results in a 1 byte transfer (cannot be done one shot 3 byte transfer), then the best way to do this would be to create a link transferred , with a PaRAM that looks exactly like your existing PaRAM and have the LinK address for your existing PaRAM to point to it
    You can refer to the 11.3.3.7 Linking Transfers and Link to Self transfer example in the TRM.

    With STATIC set to 1 and you are using A sync transfers, you will only see the 1 byte transfer and nothing else, as param fields and TRPs to TC are not incremented - it is really meant for a 1 shot transfer like QDMAs or in cases where there is no change at all in the transfer context per event (in your case you need 3 events to transfer all 3 bytes from rx buffer to memory?)
  • You are correct; it takes 3 events to transfer 3 bytes. These events come from the SPI channel as bytes are sent/received. Your suggestion to use a linked ParamSet works with STATIC cleared. That approach does exactly what we want.