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.

EDMA interrupt not occurring (using EDMA_intHook)

Other Parts Discussed in Thread: TMS320C6416

Hi,

I am having an issue where my EDMA interrupt handler routine is never being called.  I am setting up an EDMA transfer to read data off an FPGA FIFO.  I use EDMA_intHook() to hook in the ISR function to the tcc.  Here is my setup and code below:

initializeEMIFB()
{

emifRxEDMASem = SEM_create(0, 0);

int readTcc = EDMA_intAlloc(-1);

if ((readTcc != -1) && (0 != emifRxEDMASem))
{

emifReadEdmaConfig.opt = EDMA_OPT_RMK(
                                                        EDMA_OPT_PRI_LOW,
                                                        EDMA_OPT_ESIZE_16BIT,
                                                        //EDMA_OPT_ESIZE_32BIT,
                                                        EDMA_OPT_2DS_NO,
                                                        EDMA_OPT_SUM_NONE,
                                                        EDMA_OPT_2DD_NO,
                                                        EDMA_OPT_DUM_INC,
                                                        EDMA_OPT_TCINT_YES,
                                                        EDMA_OPT_TCC_OF( readTcc & 0x0F),
                                                        EDMA_OPT_TCCM_OF( (readTcc >> 4) & 0x03 ),
                                                        EDMA_OPT_ATCINT_DEFAULT,
                                                        EDMA_OPT_ATCC_DEFAULT,
                                                        EDMA_OPT_PDTS_DEFAULT,
                                                        EDMA_OPT_PDTD_DEFAULT,
                                                        EDMA_OPT_LINK_YES,
                                                        EDMA_OPT_FS_YES );

emifReadEdmaConfig.src = (Uint32) RX_FIFO_DATA;
emifReadEdmaConfig.idx = EDMA_IDX_OF( 0 );
emifReadEdmaConfig.rld = EDMA_RLD_OF( 0 );

EDMA_intHook(readTcc, (EDMA_IntHandler) EmifMsgEdmaRxCmpltIsr);

EDMA_intEnable(readTcc);

EDMA_intClear(readTcc);

}

ISR code:

void EmifMsgEdmaRxCmpltIsr(int tcc)
{
          EDMA_intClear(tcc);
          SEM_post(emifRxEDMASem);
}

execution of read code:

emifReadEdmaConfig.cnt = readDataLength*2;
emifReadEdmaConfig.dst = (Uint32)&dmaReadBuffer[0];
                
//Check to make sure there IS a length!
if (emifReadEdmaConfig.cnt)
 {
        //Invalidate the cache
        CACHE_invL2(reinterpret_cast<unsigned short*>(&dmaReadBuffer[0]), readDataLength*4, CACHE_WAIT);

         // QEDMA the data
          EDMA_qdmaConfig(&emifReadEdmaConfig);
                        
         // Wait for EDMA completion (release the CPU for others)
         SEM_pend(emifRxEDMASem, SYS_FOREVER);

.... }

and so it never returns from the SEM_pend, and I've set a breakpoint in the EmifMsgEdmaRxCmpltIsr() function, which never gets hit.

I've verified that the DMA is working though, because without the SEM_pend I do get data placed in the buffer from the FPGA, but sometimes it places zeros (or maybe nothing), which is leading me to believe I am accessing the buffer before the DMA completes.  Hence why I would like to add in the SEM_pend and ISR functionality.

  • Hi Loren,

    What version of SYS/BIOS are you using?  What device are you compiling for?

    Thanks,

    -- Emmanuel

  • We are building for a TMS320C6416 chip, using BIOS 5_31_02 on Code Composer v3.3

    Just fyi, I got this working using the HWI dispatcher code, but am still curious why the CSL way won't work.  Let's pursue so maybe this might help someone else one day as well!

  • Hi Loren,

    The HWI dispatcher is necessary when writing ISR functions in C.  When an interrupt occurs, the HWI dispatcher performs BIOS required operations to store the current context and enable the use of BIOS modules (Semaphores, Gates, etc) before the ISR is executed.  Additionally, when an ISR is complete the HWI dispatcher restores context and determines what will execute next.  For example, if a SWI is triggered or a Task with a higher priority (than the one executing prior to the HWI) must be run, the HWI dispatcher allows said SWI or Task get control and execute (performing context saves as necessary).

    To use a C function as an ISR without the HWI dispatcher the function must be declared as an ISR function (BIOS will recognized it as a valid ISR) and care should be taken not to use BIOS modules (Semaphores, etc.) within the ISR.

    Assembly ISR functions can also be used without the HWI dispatcher, but needless to say, care should be taken to properly store and restore registers. 

    Thanks,

    -- Emmanuel