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.

GPIO interrupt for PSP driver

Other Parts Discussed in Thread: OMAPL138

Hi,

 

I am using OMAPL138 ,BIOS PSP drive and CCS..

I want to use GPIO Bank2_12 (configure this pin as a GPIO) pin as a falling edge trigger interrup. As per GPIO example i configure perfectly.

but as shown in example, we can only register bank (all pins)for interrupt , not a single pin.

//// as per comment ////

//Set the interrupt handler for GPIO2_12_PIN. However we cannot register  *
 //    * interrupts for individual pins in C6748, therefore  register interrupt *
 //    * for the associated bank(BANK2) as a whole

So in my case, i use other peripheral on same bank2 like SPI1.

So when ever my SPI communicate, GPIO interrupt generated. But i only want to consider GPIO2_12 pin interrupt. I didnt find anything in drive documentation , which can read the interrupt status.

How can i use only one pin as a GPIO interrupt without affecting others in bank ?

  • Hi Sam,

     

    Interrupts can be registered only for the entire bank(Individual banks) but not for individual pins of the bank in GPIO.

    Well if you are using two/more pins of the same bank, then register an interrupt for that bank.Then inside the Interrupt handler, identify the pin number of the respective bank that caused the occurance of interrupt and then perform the required operation.

    If you refer the GPIO User's Guide Page:39, lists the GPIO Interrupt Status Registers which gives the status of the Interrupt occuring from which pin and which bank of GPIO. Depending on this information(status), you can determine which pin has caused the interrupt!.

     

    Thanks & regards,

    Raghavendra

  • Hi,

    so as per your suggestion, i would like to go that way.

    Why other bits are not change when in  INTSTAT23 , i can see only one bit change there related to GPIO2_12 . But Code enter ISR many time . Do i need to configure anything? My Interrupt configuration code here.

         Gpio_IntrCmdArg   intrCmdArg;
        Gpio_PinCmdArg    pinCmdArg;

        /* Configure GPIO(GPIO2_12_PIN) as an input                                */
        pinCmdArg.pin   =GPIO2_12_PIN;
        pinCmdArg.value = Gpio_Direction_Input;
        Gpio_setPinDir(gpio0, &pinCmdArg,&eb);

       

        /* Configure GPIO(GPIO2_12_PIN) to generate interrupt on falling edge      */
        Gpio_setFallingEdgeTrigger(gpio0, GPIO2_12_PIN,&eb);
              

        /* Set the interrupt handler for GPIO2_12_PIN. However we cannot register  *
         * interrupts for individual pins in C6748, therefore  register interrupt *
         * for the associated bank(BANK2) as a whole                              */
        intrCmdArg.value = GPIO_BANK_2;
        intrCmdArg.bankOrPin = Gpio_BankOrPin_isBank;
        intrCmdArg.isrHandler = (Gpio_Isr)gpioInputIsr;
        Gpio_regIntHandler(gpio0, &intrCmdArg,&eb);
       
        /* Enable GPIO Bank interrupt for bank GPIO_BANK_2                        */
        Gpio_bankInterruptEnable(gpio0, GPIO_BANK_2,&eb); 

    I am reading INTSTAT23 .But it read always zero. I put my code here. If i can read the status then i can clear that interrupt too.

     

    static CSL_GpioRegsOvly     gpioRegs = (CSL_GpioRegsOvly)(CSL_GPIO_0_REGS);

    volatile unsigned long status ;

    volatile Int32      flag  = 0;

     

    Void gpioInputIsr(Ptr ignore)
    {
       
        Gpio_PinCmdArg  pinCmdArg;
       
        status = gpioRegs->BANK[2].INTSTAT ;

    /* i always get status zero */


        System_printf("Int Status = %d\n", status);
       
        /* To avoid compiler warnings                                             */
         ignore = ignore;
         count_isr ++ ;
       
        if(status & CSL_GPIO_INTSTAT_STAT12_MASK) 
        {
            /* Clear the interrupt status                                             */
              pinCmdArg.pin = GPIO2_12_PIN;
              Gpio_clearInterruptStatus(gpio0,&pinCmdArg,NULL);
              flag = 1;
        }
           
    }

    I configure GPIO in configuration file as a below code....But as in GPIO EXAMPLE of OMAP_ARM ,hwiNum  = 12; which is for bank 4, but i am using bank 2 , does this number remain same ?

    gpioParams.BankParams[2].inUse = Gpio.InUse_No;
    gpioParams.BankParams[2].hwiNum  = 12;
    gpioParams.BankParams[2].PinConfInfo[12].inUse = Gpio.InUse_No;

  • Hi Sam,

     

    I request you to kindly go through the following posts:

    http://e2e.ti.com/support/embedded/int-embedded_software/f/123/p/86608/303334.aspx#303334

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/83410/291148.aspx#291148

    The requirements and setup seems quiet similar..

    Probably, this can provide more insight to the issue and help you solve it.

     

    Refer and do try and let us know the results..

     

    Thanks & regards,

    Raghavendra

  • Hi,

    I already checked 2nd post. first post link is not working. i think , i read most of the post realted to GPIO interrupt in forum.

    i did not find the reason for gpioParams.BankParams[4].hwiNum  = 12; in GPIO OMAP_ARM example of BIOSPSP.

    Can u tell me why 12 for bank 4, where do it mention ? and what abt hwinNum in  other bank , like bank 2 ?

  • Hi Sam,

    So, after going through the post, did you try making the same modification in the Gpio.c file and check if it made any difference in your application?.

    And secondly, can you please confirm the BIOS and the BIOS PSP versions you are using?.

    Coming to your question, when it comes to ARM, the "hwiNumber" sets the priority/channel for the interrupt. But for interrrupt registration, the event number is used. Refer Gpio.c file Line:1629 and this event number is pulled in from the soc.xs file.  

    If you refer the OMAPL138 System Reference Guide Page:239 Lists Event numbers for GPIO Bank 0 to 8 Interrupts. These event numbers are used for Interrupt registration.

     

    Thanks & regards,

    Raghavendra 

  • First of all thank zou very much for all information.

    I solved my problem, My code and configuration was perfect .As i have custom board.But the other device also use same pin and make it interrupted, silly mistake :( . i change my GPIO Bank and it works now.

     

    One more thing i would like to know in detail. As u mentioned that hwiNumber sets the priority/channel , which is not related to interrupt event rite ?

    and why did u set it 12 in GPIO OMAP_ARM example, why do we need priority in that task ?I think if i have multiple  GPIO interrut, then this priority help in application.

      if it s priority then it can be any priority number. Please clarify this to me.

  • Hi Sam,

     

    Good its working now!..

    Coming to your questions, When using the DSP, we use the hwiNumber to register the interrupts this is because we use a ECM module and this hwiNumber comes into picture and is used for interrupt registration(not ellaborated much here). Whereas in ARM, this hwiNumber is not used for interrupt registration but only the direct cpu event numbers are used. Just to maintain uniformity between the applications and drivers, we have overloaded the functionality(hwiNumber) by not introducing another variable name. Hence, In ARM the hwiNumber is not removed but instead used in providing the the priority/channel for the event interrupt . I request you to kindly go through the Sections: 12.1 , 12.3.4 of OMAPL138 System Reference Guide. This will help you in giving a clear picture of  interrupt mapping and prioritization.

    Hope this clarifies your questions..

     

    Since this issue is solved now, Can you please close this thread?. 

     

    Best Regards,

    Raghavendra

  • Hi Raghavendra,

     

    Regarding the GPIO interrupt. Do I need to wrapped my isr with HWI_enter and HWI_exit?

     

    Thanks,

    Yaniv 

  • Hi yaniv,

    No, not necessary..

     

    Thanks & regards,

    Raghavendra

  • Hi Raghavendra,

     

    Thank you for your quick response.

     

    Is the GPIO ISR already wrapped with HWI_enter and HWI_exit? The dispatcher is active? 

     

    Thanks,

    Yaniv

  • Hi Yaniv,

    I do not think so!..The interrupts of the GPIO for DSP are handled via the ECM module(Event combiner). Of the total 4 ECM groups, each ECM group manages 32 events and hence a total of 128 events. And if any one of the 32 events occur, an interrupt is driven to one of the core interrupts. For GPIO provided by the PSP, (7-10)groups are in use by the ECM (refer ECM configuration in .tcf file).

    Please refer the TMS320C6000 DSP/BIOS 5.x Application Programming Interface (API) Reference Guide for full explanation of the ECM(Page: 149).

    Hope this answers your questions..

    Thanks & regards,

    Raghavendra

  • Hi Raghavendra,

    Thank you very much for the detailed explanation.

    Thanks,

    Yaniv