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.

I can't get an interrupt on the ARM side (ARM works with SYSBIOS)

Other Parts Discussed in Thread: SYSBIOS, OMAPL138

I try to get an interrupr from GPIO bank 2 on the ARM side (it works with SYSBIOS 6). It looks strange 'cause I thought it'll be easy to configure interrupts with SYSBIOS similarly to DSP side. My ISR function doesn't execute although I can see a pending flag in the periphery register.

I use the interrupt number 4, pin 4 from the gpio bank 2. The event number is 44 for the gpio bank 2.

These are several screenshots which will help to understand a problem:

This is a flag of the interrupt

This is a state of the interrupt enabling:

Some registers:

Vector locations and memory map:

SYSBIOS config:

Could anybody explain what is wrong?

  • Hi Tankist,

    The gpio interrupt example already exists for OMAPL138 as a part of OMAPL138 starterware example.

    A little while ago, I have run this interrupt driven gpio example and observed the interrupt occurrence was successful without any problem.

    I would recommend you to have a look at the configuration code of the gpio interrupt and compare it with yours.

    #include "interrupt.h"
    #include "uartStdio.h"
    #include "gpio.h"
    #include "psc.h"
    
    #include "soc_OMAPL138.h"
    #include "evmOMAPL138.h"
    
    /****************************************************************************/
    /*              LOCAL FUNCTION PROTOTYPES                                   */
    /****************************************************************************/
    static void Delay(volatile unsigned int delay);
    static void ConfigureIntGPIO(void);
    static void CheckCardStatus(void);
    static void SetupInt(void);
    static void GPIOIsr(void);
    
    /****************************************************************************/
    /*              GLOBAL VARIABLES                                            */
    /****************************************************************************/
    volatile unsigned char flag = 0;
    
    /****************************************************************************/
    /*             LOCAL FUNCTION DEFINITIONS                                   */
    /****************************************************************************/
    
    int main(void)
    {
    
    
        /* The Local PSC number for GPIO is 3. GPIO belongs to PSC1 module.*/
        PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON,
    		     PSC_MDCTL_NEXT_ENABLE);
    
        /* Initializes the UART instance.*/
        UARTStdioInit();   
    
        /* Pin Multiplexing of pin 0 of GPIO Bank 4.*/
        GPIOBank4Pin0PinMuxSetup();
    
        /* Sets the pin 65(GP4[0]) as input.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 65, GPIO_DIR_INPUT);
    
        /*
        ** Configure rising edge and falling edge triggers on pin 65 to generate
        ** an interrupt
        */
        GPIOIntTypeSet(SOC_GPIO_0_REGS, 65, GPIO_INT_TYPE_BOTHEDGE);
    
        /* Enable interrupts for Bank 4.*/
        GPIOBankIntEnable(SOC_GPIO_0_REGS, 4);
    
        /* Configuring the AINTC to handle interrupts.*/
        SetupInt();
        
        /* Configure GPIO interrupts */
        ConfigureIntGPIO();
    
        UARTPuts("StarterWare GPIO Demo Application.\r\n", -2);
        UARTPuts("Insert an MMC/SD card.\r\n", -2);
    
        while(1)
        {
            if(flag == 1)
            {
                CheckCardStatus();
            }
        }
    
    } 
    
    
    
    /*
    ** \brief   This function invokes necessary functions to configure the ARM 
    **          processor and ARM Interrupt Controller(AINTC) to receive and
    **          handle interrupts.
    */
    
    static void SetupInt(void)
    {
    	// Setup ARM or DSP interrupt controller
    
    #ifdef _TMS320C6X
    	// Initialize the DSP Interrupt Controller
    	IntDSPINTCInit();
    
    	// Enable DSP Interrupts Globally
    	IntGlobalEnable();
    #else
        /* Initialize the ARM Interrupt Controller.*/
        IntAINTCInit();
    
         /* Enable IRQ in CPSR.*/
        IntMasterIRQEnable();
    
        /* Enable the interrupts in GER of AINTC.*/
        IntGlobalEnable();
    
        /* Enable the interrupts in HIER of AINTC.*/
        IntIRQEnable();
    #endif
    }
    
    
    /*
    ** \brief  This function configures the AINTC to receive the GPIO interrupt.
    */
    
    static void ConfigureIntGPIO(void)
    {
    	// Configure GPIO interrupts for ARM or DSP
    
    #ifdef _TMS320C6X
    	// Register the ISR in the Interrupt Vector Table
    	IntRegister(C674X_MASK_INT4, GPIOIsr);
    
    	// Map the system interrupt to the DSP maskable interrupt
    	IntEventMap(C674X_MASK_INT4, SYS_INT_GPIO_B4INT);
    
    	// Enable DSP maskable interrupt
    	IntEnable(C674X_MASK_INT4);
    #else
        // Register the ISR in the Interrupt Vector Table.
        IntRegister(SYS_INT_GPIOB4, GPIOIsr);
    
        // Map the channnel number 2 of AINTC to GPIO BANK 4 system interrupt.
        IntChannelSet(SYS_INT_GPIOB4, 2);
    
        // Enable the System Interrupts for AINTC.
        IntSystemEnable(SYS_INT_GPIOB4);
    #endif
    }
    
    
    /*
    ** \brief   Interrupt Service Routine to be executed on GPIO interrupts.
    **          This disables the bank interrupts, clears the system interrupt
    **          status and pin interrupt status. This also sets flag as 1.
    */
    static void GPIOIsr(void)
    {
        /* Disable the interrupts for pins of bank 4 in GPIO.*/
        GPIOBankIntDisable(SOC_GPIO_0_REGS, 4);
    
    #ifdef _TMS320C6X
        // Clear the system interrupt status in the DSPINTC
        IntEventClear(SYS_INT_GPIO_B4INT);
    #else
        /* Clears the system interrupt status of GPIO in AINTC.*/
        IntSystemStatusClear(SYS_INT_GPIOB4);
    #endif
    
        /* Clears the Interrupt Status of GP4[0] in GPIO.*/
        GPIOPinIntClear(SOC_GPIO_0_REGS, 65);
    
        flag = 1;
    }
    
    /*
    ** \brief  This function checks the insertion status of the MMC/SD card
    **         in the device and prints related statements on the serial
    **         commuincation console of the external device.
    **         
    */
    
    static void CheckCardStatus(void)
    {
        Delay(0x1FFF);
        
    #ifdef _TMS320C6X
        // Clear the system interrupt status in the DSPINTC
        IntEventClear(SYS_INT_GPIO_B4INT);
    #else
        /* Clears the system interrupt status of GPIO in AINTC.*/
        IntSystemStatusClear(SYS_INT_GPIOB4);
    #endif
    
        /* Clears the Interrupt Status of GP4[0] in GPIO.*/
        GPIOPinIntClear(SOC_GPIO_0_REGS, 65);
        
        /* 
        ** 'GPIOPinRead' here returns the value on the GP4[0].
        ** If value returned is 1, it implies the card is removed.
        ** If value returned is 0, it implies the card is inserted.
        */
    
        if (GPIOPinRead(SOC_GPIO_0_REGS, 65))
        {
            UARTPuts("MMC/SD card is removed.\n\r", -2);
        }
        else
        {
            UARTPuts("MMC/SD card inserted.\n\r", -2);
        }
    
        flag = 0;
    
        /* Enable interrupts for pins of bank 4.*/
        GPIOBankIntEnable(SOC_GPIO_0_REGS, 4);
    }
    
    /*
    ** \brief   This function can be called to generate a delay.
    */
    
    static void Delay(volatile unsigned int delay)
    {
        while(delay--);
    }
    
    
    /*****************************END OF FILE************************************/
    

  • Unfortunately it still doesn't work even with your example. My board is LCDK, not EVM.

    I attached my project here. Could anybody check it?

    test_ARM_GPIO_int.zip

  • Hi Tankist,

    The project , "gpio_armv5_omapl138_evmOMAPL138" located at "~\ti\OMAPL138_StarterWare_1_10_04_01\build\armv5\cgt_ccs\omapl138\evmOMAPL138\gpio" should work on OMAPL138 LCDK.

    I have tested it now. It works. As the same GPIO pin (GPIO4[0]) are used ( for SD card detect ) in both the LCDK and EVM, you can use this project on OMAPL138 LCDK board.

    Had a look at your project. I have attached a gpio.cmd file for you. In your project, instead of "OMAPL138.cmd", use the attached gpio.cmd and try again. It should most probably work.

    Able to run your project and make it work with the following changes.

    1. Replace the attached gpio.cmd ( In CCS--properties-->CCS general-->Linker command file -->gpio.cmd )

    2. Add system_config.lib into your project. ( In CCS properties --> ARM Linker --> File search path --> Include library file < system_config.lib > and it path as well.

    3. Include "syscfg.c" to your project.

    4. Rebuild your project. 

    5. Here you go.... YOU CAN NOW OBSERVE THE TERA TERM MESSAGES AND IT WORKS AS EXPECTED.

    Attached the project as well. 4024.test_ARM_GPIO_int.zip

    gpio.cmd

  • Your explanation exactly helps to adjust interrupts on the ARM side, I got them in my test project. So thank you very much!

    The only problem is the function IntAINTCInit() replaces the interrupt vector table:

        /* Assign the ISR Table Address to VBR */
        HWREG(SOC_AINTC_0_REGS + AINTC_VBR) = (unsigned int)fnRAMVectors;

    and SYSBIOS, of course, immediately stops work. I think the best choice is to publish this issue in the "embedded software" forum thread.

  • Hi Tankist,
    Good.
    Thanks for your update.