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.

Compiler/TMS320C5535: INTERRUPT REGISTERS

Part Number: TMS320C5535
Other Parts Discussed in Thread: TMS320C5515

Tool/software: TI C/C++ Compiler

Hallo,

I work for a project and I have to use GPIO REGISTERS, in order to generate INTERRUPT on the pin -PIO10 or GPIO11. When the interrupt is active, must blink a led.

I use the board ezdsp5535 and for code I use CCSv4.

But I have a problem. I wrote the code in C and I had not errors, but the interrupt doesn`t active. I don`t know, why or what is the problem??!! Maybe, I set wrong a register??

In attachement, it is the program. Please, I need a suggestion, a advice.

Thank you!

Cristina

#include "ezdsp5535.h"
#include <stdio.h>
#include <csl_general.h>
#include "ezdsp5535_led.h"
#include "registers.h"
#include "interrupts.h"


Uint16 led = FALSE;

void GPIO_IntrTest(void);

interrupt void INT_GPIO(void);

void gpio_output_pin_toggle(void);
        
void main(void)
{
	
	
        EZDSP5535_LED_init( );
        EZDSP5535_XF_toggle();
      

        /*CALL THE FUNCTION!!!!!*/
	GPIO_IntrTest(); 

	gpio_output_pin_toggle();
	printf("test....\n");
	
        while(1)
        {}
        
}//ENDMAIN


/*THE FUNCTION FOR BLINKING THE LED*/
void gpio_output_pin_toggle(void)
{
    if (led)
    {
        EZDSP5535_LED_off(1);
        led=~led;
    }
    else
    {
        EZDSP5535_LED_on(1);
        led=~led;
    }
    //printf("TOGGLE PIN!\n");
}


/*THE FUNCTION FOR SETTING THE INTERRUPT REGISTERS*/
void GPIO_IntrTest(void)
{
	IODIR1|=(0<<GPIO11); /*SET THE GPIO10 AS INPUT PIN*/
	IOINTEDGE1|=(1<<GPIO10);/*FOR CONFIGURING INTERRUPT TO TRIGGER ON THE FALLING EDGE*/
	IOINTEN1|=(1<<GPIO10);/*FOR ENABLING INTERRUPT ON THE GPIO10 PIN*/
	//IOINTFLG1|=(1<<GPIO10);
	
    IRQ_hook_func(INT_GPIO, ISR_GPIO); // hook interrupt function in vector table
    IRQ_enable(ISR_GPIO);    // enable GPIO interrupt in IERx register                                                                                               // globally enable interrupts (INTM)
    IRQ_globalEnable();		/* ENABLE CPU Interrupts */
	
}//END GPIO_IntrTest


/*THE FUNCTION FOR INTERRUPT*/
interrupt void INT_GPIO(void)
{
	IOINTFLG1|=(1<<GPIO10);
	IODATAIN1^=(1<<GPIO10);
	
        /*BLINKING LED*/
	gpio_output_pin_toggle();
	
	printf("END ..... ISR\n");
	
}//END INTGPIO

  • Hi Cristina,

    Is seems that you are properly set IOINTEN1 as it is described in the TMS320C5515/14/05/04/VC05/VC04 DSP General-Purpose Input/Output (GPIO) User's Guide section 3.5 at:

    But you can refer to c55_csl_3.08/demos/TIesr/c5535/TIesr_C55_demo/src/gpio_control.c GPIO demo example for complete GPIO module configuration.

        intEn |= 1 << 10;
        config.GPIODIRL = ioDir & 0xFFFF;
        config.GPIODIRH = ioDir >> 16;
        config.GPIOINTENAL = intEn & 0xFFFF;
        config.GPIOINTENAH = intEn >> 16;
        config.GPIOINTTRIGL = intEdg & 0xFFFF;
        config.GPIOINTTRIGH = intEdg >> 16;
        status = GPIO_config(hGpio, &config);
        if (status != CSL_SOK)
        {
            return status;
        }

    BR

    Tsvetolin Shulev

  • Hallo T.Shulev,

    thank you so much for your attention and implication.

    Please, if you can, attach all the program, because I don`t find it (c55_csl_3.08/demos/TIesr/c5535/TIesr_C55_demo/src/gpio_control.c ).

    This thing will help me very much.

    Thank you again!

    Cristina

  • Here is the download link:
    software-dl.ti.com/.../index_FDS.html

    BR
    Tsvetolin Shulev
  • Hallo Tsvetolin S.,

    Thank you so much for the informations.

    Best Regards,

    Cristina

  • Hallo Tsvetolin Shulev,

    I have a problem again. The program gives this error :"could not open source file "std.h" ". I tried to introduce this file in the program`s workspace, but it is not good.

    The second problem is that I don`t understand how can I achieve the relation between my function (to blink a led) and the interrupt service routine (ISR)???

     When an interrupt is invoked, the microcontroller runs the interrupt service routine. But in this case, where is the address for my ISR???

    The third problem is how must I set the parameters from this function: "CSL_Status GpioInit(Uint32 ioDir, Uint32 intEn, Uint32 intEdg, Uint32 oVal)"

    I try to call the function in this mode:

    "CSL_Status GpioInit(0x0000, 0x0400, 0x400, 0x0);

    /* ioDir=0x0000; SET THE GPIO10 AS INPUT PIN
    intEn=0x0400; FOR ENABLING INTERRUPT ON THE GPIO10 PIN
    intEdg=0x0400; FOR CONFIGURING INTERRUPT TO TRIGGER ON THE FALLING EDGE */ "

    It`s ok???

    I want to mention that I have to use GPIO REGISTERS, in order to generate INTERRUPT on the pin -GPIO10 or GPIO11. When the interrupt is active, must blink a led.

    I use the board ezdsp5535 and for code I use CCSv4.

    These are my questions. In attachement, it is the program. Please, I need a suggestion, an advice.

    Thank you so much for you attention!

    Cristina

  • I specified my problems below.
  • I forgot to insert all the program. Here is!!! Thank you!

    #include "ezdsp5535.h"
    #include <stdio.h>
    #include <csl_general.h>
    #include "ezdsp5535_led.h"
    
    #include <std.h> ;//HERE IS THE PROBLEM!!!
    #include "csl_types.h"
    #include "csl_gpio.h"
    
    GPIO_Handle hGpio;
    CSL_GpioObj gGpioObj;
    
    Uint16 led = FALSE;
    
    CSL_Status GpioInit(Uint32 ioDir, Uint32 intEn, Uint32 intEdg, Uint32 oVal);
    
    interrupt void INT_GPIO(void);
    
    void gpio_output_pin_toggle(void);
            
    void main(void)
    {
    	
            EZDSP5535_LED_init( );
            EZDSP5535_XF_toggle();
         
            /*CALL THE FUNCTION!!!!!*/
    	
         CSL_Status GpioInit(0x0000, 0x0400, 0x400, 0x0);
         
        /*  ioDir=0x0000; SET THE GPIO10 AS INPUT PIN
            intEn=0x0400; FOR ENABLING INTERRUPT ON THE GPIO10 PIN
            intEdg=0x0400; FOR CONFIGURING INTERRUPT TO TRIGGER ON THE FALLING EDGE  */
    	
            while(1)
            {}
            
    }//ENDMAIN
    
    
    /*THE FUNCTION FOR BLINKING THE LED*/
    void gpio_output_pin_toggle(void)
    {
        if (led)
        {
            EZDSP5535_LED_off(1);
            led=~led;
        }
        else
        {
            EZDSP5535_LED_on(1);
            led=~led;
        }
    }
    
    
    /*THE FUNCTION FOR SETTING THE INTERRUPT REGISTERS*/
    CSL_Status GpioInit(Uint32 ioDir, Uint32 intEn, Uint32 intEdg, Uint32 oVal)
    {
        CSL_GpioConfig config;
        Uint16 i;
        CSL_Status status;
    
        /* Open GPIO module */
        hGpio = GPIO_open(&gGpioObj, &status);
        if ((hGpio == NULL) || (status != CSL_SOK))
        {
            return status;
        }
    
        /* Reset GPIO module */
        status = GPIO_reset(hGpio);
        if (status != CSL_SOK)
        {
            return status;
        }
    
        /* Configure GPIO module */
        config.GPIODIRL = ioDir & 0xFFFF;
        config.GPIODIRH = ioDir >> 16;
        config.GPIOINTENAL = intEn & 0xFFFF;
        config.GPIOINTENAH = intEn >> 16;
        config.GPIOINTTRIGL = intEdg & 0xFFFF;
        config.GPIOINTTRIGH = intEdg >> 16;
        status = GPIO_config(hGpio, &config);
        if (status != CSL_SOK)
        {
            return status;
        }
    
        /* Write output values for outputs */
        for (i=0; i<CSL_GPIO_NUM_PIN; i++)
        {
            if ((ioDir>>i) & 0x1)
            {
                GPIO_write(hGpio, (CSL_GpioPinNum)i, ((oVal>>i) & 0x1));
            }
        }
    
        return CSL_SOK;
    }
    
    
    
    /*THE FUNCTION FOR INTERRUPT*/
    interrupt void INT_GPIO(void)
    {
    	
            /*BLINKING LED*/
    	gpio_output_pin_toggle();
    	
    	printf("END ..... ISR\n");
    	
    }//END INTGPIO