Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

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.

TMS320F28379D: GPIO Interrupt Configuration using SYS/BIOS

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi,

I would like to know if there is an example for configuring GPIO interrupt using SYS/BIOS.

The generic example uses PIE Vector tables and I guess it should not be used while using SYS/BIOS.

Thanks,

Rashmitha

  • Hi Rashmitha,

    Correct--instead of configuring the PIE, you'll use the Hwi module. We don't have an example that specifically does this for XINTs, but the "pie" example gives a nice demonstration on how to create a Hwi instance. Instructions on importing examples are here if you need them.

    Other than the PIE configuration, the way you configure the GPIO and XINT registers should remain pretty much the same and can be copied over from the C2000Ware example you're using as a reference.

    Whitney

  • Hi Whitney,

    I created the project referring to the examples you suggested

    In my app.cfg I have the below code

    /* PIE group 1, interrupt 4 */
    var interruptNum = 35;
    var hwiParams = new Hwi.Params();
    hwiParams.arg = interruptNum;
    hwiParams.enableAck = true;
    hwiParams.maskSetting = Hwi.MaskingOption_BITMASK;
    hwiParams.disableMask = 0x0;
    hwiParams.restoreMask = 0x0;
    Hwi.create(interruptNum, "&gpioInterruptHandler", hwiParams);
    
    

    In my GPIO_Initialization I have the below code

    void GPIO_Initialisation()
    {
         GPIO_setPinConfig(GPIO_31_GPIO31);
         GPIO_setDirectionMode(31,GPIO_DIR_MODE_OUT);
    //     GPIO_setPadConfig(31,GPIO_PIN_TYPE_PULLUP);
         GPIO_setMasterCore(31, GPIO_CORE_CPU1);
    
         GPIO_setPinConfig(GPIO_34_GPIO34);
         GPIO_setDirectionMode(34,GPIO_DIR_MODE_OUT);
    //     GPIO_setPadConfig(34,GPIO_PIN_TYPE_PULLUP);
         GPIO_setMasterCore(34, GPIO_CORE_CPU1);
    
         GPIO_setPinConfig(GPIO_11_GPIO11);
         GPIO_setDirectionMode(11,GPIO_DIR_MODE_IN);
         GPIO_setQualificationMode(11,GPIO_QUAL_SYNC);
         GPIO_SetupXINT1Gpio(11);
    
         GPIO_setInterruptType(GPIO_INT_XINT1, GPIO_INT_TYPE_FALLING_EDGE);
         GPIO_setInterruptPin(11, GPIO_INT_XINT1);
         GPIO_enableInterrupt(GPIO_INT_XINT1);
    
    
    }
    

    and my ISR in one of the driver files is as below

    __interrupt void gpioInterruptHandler(void)
    {
        System_printf("gpioInterruptHandler\n");
        System_flush(); /* force SysMin output to console */
    
        GPIO_togglePin(34);
    
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
    }
    

    I am trying to read from GPIO 11 (P11 on J8 connector) with a push button and see response on LEDs D9 and D10/GPIO 31/34

    But my LEDs are ON right from initialization, and the ISR is never reached

    Could you suggest what could be wrong? I have checked my wirings and push button.

  • Your Hwi set up in the config file looks good. You do need to remove the __interrupt keyword from gpioInterruptHandler though--that's not necessary for Hwi functions.

    If you put a breakpoint in gpioInterruptHandler does it ever hit it? What if you manually set the PIEIFR1.INTx4 bit in the Registers window? Does that trigger the interrupt?

    Whitney

  • The breakpoint in gpioInterruptHandler does not hit.

    Even manually setting PIEIFR1.INTx4 bit does not trigger the interrupt.

    Void PIE_post(Uns intNum)
    {
        Bits16 *PIEIFRPtr;
    
        /* Flag PIE IFR */
        PIEIFRPtr = (Bits16 *)PIEIER1_ADDR + (((intNum -
                ti_sysbios_family_c28_Hwi_NUM_INTERRUPTS) >> 3) * 2) + 1;
        *PIEIFRPtr |= (1 << (intNum & 0x7));
    }
    
    Void myTaskFxn()
    {
        while(1)
        {
        /* post PIE group 1, interrupt 4 */
        System_printf("Posting PIE group 1, interrupt 35.\n");
        System_flush(); /* force SysMin output to console */
        PIE_post(35);
        }
    }

  • Did the original "pie" example work as expected for you? Can you take a look at the Hwi module in ROV to see if anything looks wrong there?

    Can you check the interrupt enable registers to confirm that interrupt 35 hasn't gotten disabled somehow? See IER.INT1 and ST1.INTM under Core Registers and PIEIER1.INTx4 in PieCtrlRegisters in the CCS registers window.

    Whitney

  • Hi Whitney,

    Thanks for pointing to the registers.  IER.INT1 was getting disabled by one of my System Initialization functions.

    Interrupt is working now.

    Thank you so much! Slight smile

     

  • Hi Whitney,

    I have a new problem with the interrupts

    Now I am trying to use 3 Interrupts XINT 1/2/3 

    Randomly at times when I press a push button that is supposed to trigger XINT1 it triggers XINT2 OR 3 also along with XINT1 . This happens with XINT2 and 3 too; shuffled random triggers to others.

    I modified the app.cfg files to not have any shared variables.

    If I add      GPIO_setQualificationMode(gpioButton01,GPIO_QUAL_3SAMPLE);

    The shuffled triggering isn't happening!

    Does it do the shuffled triggering because of faster interrupt processing?

    /* PIE group 1, interrupt 4 */
    var interruptNum = 35;
    var hwiParams = new Hwi.Params();
    hwiParams.arg = interruptNum;
    hwiParams.enableAck = true;
    hwiParams.maskSetting = Hwi.MaskingOption_BITMASK;
    hwiParams.disableMask = 0x0;
    hwiParams.restoreMask = 0x0;
    Hwi.create(interruptNum, "&gpioInterruptHandler1_Mode", hwiParams);
    
    /* PIE group 1, interrupt 5 */
    interruptNum2 = 36;
    var hwiParams2 = new Hwi.Params();
    hwiParams2.arg = interruptNum2;
    hwiParams2.enableAck = true;
    hwiParams2.maskSetting = Hwi.MaskingOption_BITMASK;
    hwiParams2.disableMask = 0x0;
    hwiParams2.restoreMask = 0x0;
    Hwi.create(interruptNum2, "&gpioInterruptHandler2_Case", hwiParams2);
    
    /* PIE group 12, interrupt 1 */
    interruptNum3 = 120;
    var hwiParams3 = new Hwi.Params();
    hwiParams3.arg = interruptNum3;
    hwiParams3.enableAck = true;
    hwiParams3.maskSetting = Hwi.MaskingOption_BITMASK;
    hwiParams3.disableMask = 0x0;
    hwiParams3.restoreMask = 0x0;
    Hwi.create(interruptNum3, "&gpioInterruptHandler3_Trigger", hwiParams3);
    
    

        /*******************Configuation of LEDs*******************/
         GPIO_setPinConfig(GPIO_58_GPIO58);
         GPIO_setDirectionMode(gpioLED01, GPIO_DIR_MODE_OUT);
    //     GPIO_setPadConfig(gpioLED01,GPIO_PIN_TYPE_PULLUP);
         GPIO_setMasterCore(gpioLED01, GPIO_CORE_CPU1);
    
         GPIO_setPinConfig(GPIO_61_GPIO61);
         GPIO_setDirectionMode(gpioLED02, GPIO_DIR_MODE_OUT);
    //     GPIO_setPadConfig(gpioLED02,GPIO_PIN_TYPE_PULLUP);
         GPIO_setMasterCore(gpioLED02, GPIO_CORE_CPU1);
    
         GPIO_setPinConfig(GPIO_122_GPIO122);
         GPIO_setDirectionMode(gpioLED03, GPIO_DIR_MODE_OUT);
    //     GPIO_setPadConfig(gpioLED03,GPIO_PIN_TYPE_PULLUP);
         GPIO_setMasterCore(gpioLED03, GPIO_CORE_CPU1);
    
         GPIO_setPinConfig(GPIO_123_GPIO123);
         GPIO_setDirectionMode(gpioLED04, GPIO_DIR_MODE_OUT);
    //     GPIO_setPadConfig(gpioLED04,GPIO_PIN_TYPE_PULLUP);
         GPIO_setMasterCore(gpioLED04, GPIO_CORE_CPU1);
    
         /*******************Configuation of Buttons*******************/
         GPIO_setPinConfig(GPIO_63_GPIO63);
         GPIO_setDirectionMode(gpioButton01,GPIO_DIR_MODE_IN);
    //     GPIO_setQualificationMode(gpioButton01,GPIO_QUAL_SYNC);
         GPIO_SetupXINT1Gpio(gpioButton01);
         GPIO_setInterruptType(GPIO_INT_XINT1, GPIO_INT_TYPE_BOTH_EDGES);
         GPIO_setInterruptPin(gpioButton01, GPIO_INT_XINT1);
         GPIO_enableInterrupt(GPIO_INT_XINT1);
    
         GPIO_setPinConfig(GPIO_64_GPIO64);
         GPIO_setDirectionMode(gpioButton02,GPIO_DIR_MODE_IN);
    //     GPIO_setQualificationMode(gpioButton02,GPIO_QUAL_SYNC);
         GPIO_SetupXINT2Gpio(gpioButton02);
         GPIO_setInterruptType(GPIO_INT_XINT2, GPIO_INT_TYPE_BOTH_EDGES);
         GPIO_setInterruptPin(gpioButton02, GPIO_INT_XINT2);
         GPIO_enableInterrupt(GPIO_INT_XINT2);
    
         GPIO_setPinConfig(GPIO_65_GPIO65);
         GPIO_setDirectionMode(gpioButton03,GPIO_DIR_MODE_IN);
    //     GPIO_setQualificationMode(gpioButton03,GPIO_QUAL_SYNC);
         GPIO_SetupXINT3Gpio(gpioButton03);
         GPIO_setInterruptType(GPIO_INT_XINT3, GPIO_INT_TYPE_BOTH_EDGES);
         GPIO_setInterruptPin(gpioButton03, GPIO_INT_XINT3);
         GPIO_enableInterrupt(GPIO_INT_XINT3);

  • Glad you were able to find a solution. It does sound like it probably an issue of the button signals being a bit noisy, so it doesn't surprise me that enabling qualification fixed it.

    Whitney