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.

DSK6713 GPIO, EDMA interrupt issues

I have been working on a project and have run into an issue with the DSK6713 EDMA and GPIO. I have inherited some working code and tried to adapt it to the project.

Here is what I'm attempting to accomplish:

  1. Take 2 interrupt signals (edge triggered low->high) into the GPIO pins 4 & 6 (Also EXTINT4 and EXTINT6).
  2. Perform GPIO Logic Mode function AND (delta mode) to create a GPINT0 event.
  3. Handle the GPINT0 event in the EDMA to trigger a channel transfer event.
  4. EDMA event to trigger data processing

So far this code has not worked and I have been going back and forth between 3-4 datasheets trying to sort out where the issue may be.

I'm wondering if the GPIO & EDMA are being configured correctly to perform as I would like.

EDMA_Config gEdmaConfigRcv = {
    EDMA_FMKS(OPT, PRI, HIGH)          |  // Priority
    EDMA_FMKS(OPT, ESIZE, 32BIT)       |  // Element size
    EDMA_FMKS(OPT, 2DS, NO)            |  // 2 dimensional source?
    EDMA_FMKS(OPT, SUM, OF(0))         |  // Src update mode, fixed ADC address 0xB0000000
    EDMA_FMKS(OPT, 2DD, NO)            |  // 2 dimensional dest
    EDMA_FMKS(OPT, DUM, INC)           |  // Dest update mode
    EDMA_FMKS(OPT, TCINT, YES)         |  // Cause EDMA interrupt?
    EDMA_FMKS(OPT, TCC, OF(8))            |  // Transfer complete code
    EDMA_FMKS(OPT, LINK, YES)          |  // Enable link parameters?   for pong, no link
    EDMA_FMKS(OPT, FS, NO),               // Use frame sync?

    (Uint32) rxMEM_SRC,                   // Src address
    
    EDMA_FMK (CNT, FRMCNT, NULL)       |  // Frame count
    EDMA_FMK (CNT, ELECNT, BUFFSIZE),     // Element count

    (Uint32)&gBufferRcvPing,              // Dest address

    EDMA_FMKS(IDX, FRMIDX, DEFAULT)    |  // Frame index value
    EDMA_FMKS(IDX, ELEIDX, DEFAULT),      // Element index value

    EDMA_FMK (RLD, ELERLD, NULL)       |  // Reload element
    EDMA_FMK (RLD, LINK, NULL)            // Reload link
};

void initEdma(void)
{
    /* Configure receive channel */
    //Map GPINT0 (8) event to EDMA channel (4)
    hEdmaRcv = EDMA_open(EDMA_map(8,EDMA_CHA_EXTINT4), EDMA_OPEN_RESET);  // get hEdmaRcv handle and reset channel
    hEdmaReloadRcvPing = EDMA_allocTable(-1);                  // get hEdmaReloadRcvPing handle
    hEdmaReloadRcvPong = EDMA_allocTable(-1);               // get hEdmaReloadRcvPong handle

    gEdmaConfigRcv.dst = EDMA_DST_OF(gBufferRcvPing);
    EDMA_config(hEdmaRcv, &gEdmaConfigRcv);        // configure the registers for hEdmaRcv
    
    EDMA_config(hEdmaReloadRcvPing, &gEdmaConfigRcv);       // and the reload for Ping
    
    gEdmaConfigRcv.dst = EDMA_DST_OF(gBufferRcvPong);       // change the structure to have a destination of Pong
    EDMA_config(hEdmaReloadRcvPong, &gEdmaConfigRcv);       // configure the reload for Pong
    
    EDMA_link(hEdmaRcv,hEdmaReloadRcvPong);                 // link to Pong
    EDMA_link(hEdmaReloadRcvPong,hEdmaReloadRcvPing);         // link Pong to Ping
    EDMA_link(hEdmaReloadRcvPing,hEdmaReloadRcvPong);       // link Ping to Pong
 
    
    /* Enable interrupts in the EDMA controller */
    EDMA_intClear(8);                             // clear any possible spurious interrupts
    EDMA_intEnable(8);                            // enable EDMA interrupts (CIER)
    EDMA_enableChannel(hEdmaRcv);                             // enable EDMA channel
    EDMA_setChannel(hEdmaRcv);
    return;
}

GPIO_Config gpio_config ={
    0x00000032, //GPGC - LOGICMODE, LOGICTRUE = 0(active high), ANDMODE,DELTAMODE
    0x00000051, //GPEN - GPIO 0,4 enabled, 6 for 2 channel config 0x00000051
    0x00000000, //GDIR - 0 = input, 1 = output
    0x00000000, //GPVAL - since all input, just detects value, leave 0 for all.
    0x00000050, //GPHM - 4, 6 for 2 channel config 0x00000050
    0x00000000, //GPLM - Don't use high to low transitions
    0x00000000  //GPPOL - Only applies to pass through mode (not this use)
};

void initIrq(void)
{
    /* Enable EDMA interrupts to the CPU */
    IRQ_nmiEnable();
    IRQ_globalEnable();
    IRQ_map(IRQ_EVT_EDMAINT, 8);
    IRQ_reset(IRQ_EVT_EDMAINT);    // Clear any pending EDMA interrupts
    IRQ_enable(IRQ_EVT_EDMAINT);   // Enable EDMA interrupt
    return;

}

void edmaHwi( void )  
{
    EDMA_intClear(8);
    //Direct to ping or pong buffer
    if (pingOrPong==PING)
    {
        SWI_or(&processBufferSwi, PING);
        pingOrPong = PONG;
    }
    else
    {
        SWI_or(&processBufferSwi, PONG);
        pingOrPong = PING;
    }
}

int main(void)

{

/*other code*/

    gpio_handle = GPIO_open(GPIO_DEV0, GPIO_OPEN_RESET);
    GPIO_config(gpio_handle, &gpio_config);

    initEdma();

   initIrq();

/*other code*/

return;

}

I am using a Spectrum Digital TMS320C6713 DSK.

I have added the pull down resistor to the HPI_EN pin to disable the HPI and enable the GPIO pins by switching the SW3 switch 4 to on.

Thank you.

  • I haven't spent a lot of time studying your code, and haven't gotten around to exploring the EDMA yet, but since nobody else has responded, one thing I would say is that it is better to delay IRQ_globalEnable until after the other IRQ_* functions have been called.  Also, I'm pretty sure you need to enable IRQ_EVT_GPINT0 in order for the logic composite signal to reach the EDMA.

    Good luck!

  • Thanks for the point in the right direction. The GPIO event registers were not getting cleared so I had to create a HWI to clear them after a GPINT0 event so the IRQ_EVT_GPINT0 did need to be enabled. I believe that this HWI would not be required if the GPIO event registers cleared after the GPINT0 event occurred (after triggering the EDMA transfer) but I do not know of a way to test this.