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/RTOS: Using EDMA with the MMCSD controller

Hi

I have a SD driver that works (single and multiblock transfers) with interrupts but now I am trying to get the same thing working with EDMA.  However, the RTA bit in the PSTATE register remains active even after I receive a TCC from EDMA.  And the transfer buffer is obviously not written to.  I'm trying to follow the (incomplete and broken) examples in pdk_am335x_1_0_0:MMCSDDMA_v1.c where I use AB-type DMA transfers and I'm sure to set the DMA bit in the CMD register.

I don't understand why EDMA would think its finished reading when the MMCSD doesn't agree.  The BLK register and PaRAM set looks correct to me before I send the command.

Any help or advise would be appreciated.

  • Unfortunately, that is already what I am using. The PROCESSOR-SDK-RTOS-AM335X 02_00_00_00 includes pdk_am335x_1_0_0 as one of its directories.
  • One thing that looks suspicious to me is the following snippet of code where the driver is configuring the PaRAM set for a receive buffer:

    	            /* Src is in INCR mode & Dest is in FIFO modes                        */
    	            paramSet.opt &= MMCSD_EDMA3CC_OPT_DAM_INCR_MODE;
    	            paramSet.opt |= MMCSD_EDMA3CC_OPT_SAM_CONST_MODE;
    
    	            /* FIFO width is 8 bit                                                */
    	            paramSet.opt &= MMCSD_EDMA3CC_OPT_FIFO_WIDTH;

    Is the FIFO width actually correct?  Here is the rest of the PaRAM setup for reference:

    	            /* Get the PaRAM set for default parameters                               */
    	            EDMA3_DRV_getPaRAM((EDMA3_DRV_Handle) hwAttrs->edmaHandle,
    	                                    (uint32_t) hwAttrs->rxDmaEventNumber, &paramSet);
    
    	            /* Fill the PaRAM Set with transfer specific information */
    	            paramSet.destAddr  = (uint32_t)(object->dataBufIdx);
    
    	            paramSet.srcAddr = (uint32_t) ((hwAttrs->baseAddr)
    	                             + CSL_MMCHS_DATA);
    
    	            /**
    	            * Be Careful !!!
    	            * Valid values for SRCBIDX/DSTBIDX are between –32768 and 32767
    	            * Valid values for SRCCIDX/DSTCIDX are between –32768 and 32767
    	            */
    	            paramSet.aCnt       = 4;
    	            paramSet.bCnt       = (uint16_t) (transaction->blockSize / 4);
    	            paramSet.srcBIdx    = 0;
    	            paramSet.srcCIdx    = 0;
    
    	            paramSet.destBIdx   = 4;
    	            paramSet.destCIdx   = transaction->blockSize / 4;
    
    	            /* For AB-synchronized transfers, BCNTRLD is not used. */
    
    	            paramSet.linkAddr   = 0xFFFFu;
    
    	            paramSet.bCntReload = (uint16_t) 0;
    
    	            /* Src is in INCR mode & Dest is in FIFO modes                        */
    	            paramSet.opt &= MMCSD_EDMA3CC_OPT_DAM_INCR_MODE;
    	            paramSet.opt |= MMCSD_EDMA3CC_OPT_SAM_CONST_MODE;
    
    	            /* FIFO width is 8 bit                                                */
    	            paramSet.opt &= MMCSD_EDMA3CC_OPT_FIFO_WIDTH;
    
    	            /* EDMA3_DRV_SYNC_AB                                                  */
    	            paramSet.opt &= MMCSD_EDMA3CC_OPT_SYNC_MASK_VALUE;
    	            paramSet.opt |= MMCSD_EDMA3CC_OPT_SYNC_AB;
    
    	            /* EDMA3_DRV_OPT_FIELD_TCINTEN                                        */
    	            paramSet.opt |= ((uint32_t) 1U << MMCSD_OPT_TCINTEN_SHIFT);
    
    	            /* ADDED FOR ARM PLATFORM                                             */
    	            /* update the transfer completion code                                */
    	            paramSet.opt &= (~MMCSD_EDMA3CC_OPT_TCC_MASK);
    	            paramSet.opt |= (( hwAttrs->edmaRxTCC) << MMCSD_EDMA3CC_OPT_TCC_SHIFT);
    
    	            result = EDMA3_DRV_setPaRAM(hwAttrs->edmaHandle, hwAttrs->rxDmaEventNumber, &paramSet);

    Again this is cut and pasted from MMCSDDMA_v1.c.

  • I'm starting to suspect that the MMCSD controller is not sending all the DMA requests properly for a multiblock transfer. Can anyone confirm that multiblock transfers work over EDMA with the MMCSD?