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.

RTOS/AM3352: EDMA triggered by GPIO interrupt

Part Number: AM3352
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

hello!

    In our hardware design, EDMA events are triggered by GPIO interrupts to read FPGA data.

What configuration do I need for GPIO interrupts and EDMA triggers?

the PDK version is pdk_am335x_1_0_13,

Here are my GPIO Settings:

GPIODirModeSet(SOC_GPIO_0_REGS,20,GPIO_DIR_INPUT);
GPIOIntTypeSet(SOC_GPIO_0_REGS, 20, GPIO_INT_TYPE_RISE_EDGE);
GPIOPinIntEnable(SOC_GPIO_0_REGS, GPIO_INT_LINE_1, 0);

GPIODirModeSet(SOC_GPIO_0_REGS,19,GPIO_DIR_INPUT);
GPIOIntTypeSet(SOC_GPIO_0_REGS, 19, GPIO_INT_TYPE_RISE_EDGE);
GPIOPinIntEnable(SOC_GPIO_0_REGS, GPIO_INT_LINE_2, 0);

How can I set an interrupt callback function for this method of setting GPIO interrupts?

If sysbios hwi to implement, hwi id should be set?

/* ================ config hwi for GPIO,used for EDMA ================ */
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var hwiParams = new Hwi.Params;
hwiParams.arg = 5;
Program.global.hwi0 = Hwi.create(id, '&AppDMAInt0CallbackFxn', hwiParams);// is it 96 and 97 for GPIO0? and 96 is line 1, 97is lin 2?

In addition, I know how to call set the Trigger mode to Manual,

if I want to set the Trigger mode to Event, what configuration do I need to do with EDMA?

BR!

  • Hi,

    You don't have to use the low level API to configure GPIO interrupts, instead, you may refer to the GPIO example miain_led_blink.c in PDK ti\drv\gpio\test\led_blink

        /* GPIO initialization */
        GPIO_init();

        /* Set the callback function */
        GPIO_setCallback(USER_LED0, AppGpioCallbackFxn);

        /* Enable GPIO interrupt on the specific gpio pin */
        GPIO_enableInt(USER_LED0);

    Please check TRM 11.3.4.1.1 Event-Triggered Transfer Request for EDMA trigger modem. Table 11-23. Direct Mapped shows GPIO0 is directly mapped to GPIOEVT0 22, thus you need to enable the event in EER register for 22, see section 11.4.1.99 EER Register (offset = 1020h) [reset = 0h].

    Regards,
    Garrett

  • Hi Garrett

            Thank you for you feedback,I have resolved the GPIO interrupt issue.but I still have some question about trigger EDMA event.

    to enable the event of EDMA,I have modified the GPIO_soc.c。

    GPIO_v1_hwAttrs_list GPIO_v1_hwAttrs = {
    {
    SOC_GPIO_0_REGS,
    96,
    97,
    22,//change to 22,for EDMA event ,GPIO1_19 INTERRUPT
    4   //change 4,for EDMA event ,GPIO1_20 INTERRUPT
    },
    {
    SOC_GPIO_1_REGS,
    98,
    99,
    0,
    0
    },
    {
    SOC_GPIO_2_REGS,
    32,
    33,
    0,
    0
    },
    {
    SOC_GPIO_3_REGS,
    62,
    63,
    0,
    0
    },
    /* "pad to full predefined length of array" */
    { 0,0,0,0,0 },
    { 0,0,0,0,0 },
    { 0,0,0,0,0 },
    { 0,0,0,0,0 },
    };

    and flow is my EDMA test source file,I can read the data successful by methord munal,but if I change the methord to event,

    I can't get the data right.

    I just only change  EDMA3_DRV_enableTransfer (handle_edma, chId,EDMA3_DRV_TRIG_MODE_MANUAL) to 

    EDMA3_DRV_enableTransfer (handle_edma, chId,EDMA3_DRV_TRIG_MODE_EVENT) .

    the chld is same to event id from GPIO_soc

    
    


    void app_EDMA_PRCMEnable(void)
    {
        WR_MEM_32(CM_PER_TPCC_CLKCTRL,2);
        WR_MEM_32(CM_PER_TPTC0_CLKCTRL,2);
        WR_MEM_32(CM_PER_TPTC1_CLKCTRL,2);
        WR_MEM_32(CM_PER_TPTC2_CLKCTRL,2);
    }
    
    EDMA3_RM_Handle app_EDMA_Init(void)
    {
        EDMA3_DRV_Result edmaResult = 0;
        EDMA3_RM_Handle gEdmaHandle = NULL;
        Radar_log("\n------------ app_EDMA_Init --------------\n");
        app_EDMA_PRCMEnable();
        gEdmaHandle = (EDMA3_RM_Handle)edma3init(0, &edmaResult);
    
        return gEdmaHandle;
    }
    
    int32_t Radar_gpmc_edma_read(EDMA3_RM_Handle handle_edma,uint32_t srcaddr,uint32_t destaddr,uint32_t data_len)
    {
        EDMA3_DRV_Result result  = -1;
        uint32_t chId = 0;
        uint32_t BRCnt = 0;
        int srcbidx = 0, desbidx = 0;
        int srccidx = 0, descidx = 0;
        uint32_t acnt = data_len;
        uint32_t bcnt = 1;
        uint32_t ccnt = 1;
    
        EDMA3_DRV_SyncType syncType = EDMA3_DRV_SYNC_A;
    
        result = Edma3_CacheInvalidate(destaddr, (acnt*bcnt*ccnt));
        if(result != EDMA3_DRV_SOK)
        {
            Radar_log("\n Edma3_CacheInvalidate unsuccessful\n");
        }
    
        /* Set B count reload as B count. */
        BRCnt = bcnt;
    
        /* Setting up the SRC/DES Index */
        srcbidx = (int)acnt;
        desbidx = (int)acnt;
    
        if (syncType == EDMA3_DRV_SYNC_A)
        {
            /* A Sync Transfer Mode */
            srccidx = (int)acnt;
            descidx = (int)acnt;
        }
        else
        {
            /* AB Sync Transfer Mode */
            srccidx = ((int)acnt * (int)bcnt);
            descidx = ((int)acnt * (int)bcnt);
        }
    
        tcc = EDMA3_DRV_TCC_ANY;
        chId = 22;
    
        result = EDMA3_DRV_requestChannel (handle_edma, &chId, &tcc,
                                           (EDMA3_RM_EventQueue)0,
                                           NULL, NULL);
    
        result = EDMA3_DRV_setSrcParams (handle_edma, chId, (uint32_t)srcaddr,
                   EDMA3_DRV_ADDR_MODE_INCR,
                   EDMA3_DRV_W8BIT);
    
    
        result = EDMA3_DRV_setDestParams (handle_edma, chId, (uint32_t)(destaddr),
                    EDMA3_DRV_ADDR_MODE_INCR,
                    EDMA3_DRV_W8BIT);
    
    
        result = EDMA3_DRV_setSrcIndex (handle_edma, chId, srcbidx, srccidx);
    
        result =  EDMA3_DRV_setDestIndex (handle_edma, chId, desbidx, descidx);
    
        result = EDMA3_DRV_setTransferParams (handle_edma, chId, acnt, bcnt, ccnt,
                        BRCnt, syncType);
    
        result = EDMA3_DRV_setOptField (handle_edma, chId,
                    EDMA3_DRV_OPT_FIELD_TCINTEN, 1u);
    
        result = EDMA3_DRV_setOptField (handle_edma, chId,
                    EDMA3_DRV_OPT_FIELD_ITCINTEN, 1u);
    
        result = EDMA3_DRV_enableTransfer (handle_edma, chId,EDMA3_DRV_TRIG_MODE_MANUAL);
        if (result != EDMA3_DRV_SOK)
        {
            Radar_log ("edma3_test_poll_mode: EDMA3_DRV_enableTransfer " \
                "Failed, error code: %d\r\n", result);
        }
         return result;
    }
    
    
    void Task_gpmc(UArg a0, UArg a1)
    {
        EDMA3_RM_Handle handle_edma;
    
        handle_edma = app_EDMA_Init();
        if (handle_edma == NULL)
        {
            Radar_log("\n EDMA driver initialization unsuccessful\n");
        }
        dstBuff1 = (signed char*) GLOBAL_ADDR(_dstBuff1);
        Radar_gpmc_edma_read(handle_edma,GPMC_ADDRESS,(uint32_t)dstBuff1,4);
    }
    

  • Hi,

    >>I can't get the data right.

    Is the data shifted or not transferred at all? Can you check if the event 22 bit is enabled in EER Register?

    Regards,

    Garrett

  • Hi

            There is no data transferred at all,I don't know how to check if the event 22 bit is enabled in EER register.

    if possible ,can you please help  to give us a methord.

  • Hi,

    The EER register is located at 0x4900_0000 with offset 0x1020.

    Regards,
    Garrett