Hi!
I am writing a program that runs two ISR's, each assigned to an external interrupt of the GPIO (EXT_INT6 and EXT_INT7). We are going to interface this connection with a microcontroller and the interrupts are programmed to be active on a low to high transition. Right know I am only doing tests with the Voltage and GND signals from the C6713 DSK on a protoboard. I connect the cable to GND and as soon as I unplug it from GND, the interrupt becomes active. If I then connect the cable to voltage, the interrupt does not work. Then, my interrupts only work when the cable goes from GND to being unplugged... I would like to know why is this happening and if it safe to test this "interrupt simulation" (instead of using a cable that i manually plug and unplug) with a switch that connects to GND or Voltage the GPIO pin.
Here is my code:
#include <dsk6713.h>
#include <csl_gpio.h>
#include <csl_gpiohal.h>
#include <csl_irq.h>
#include <csl.h>
#include <stdio.h>
#include "DSPBIOScfg.h"
int pin8 = -1;
int pin9 = -1;
int pin10 = -1;
int pin11 = -1;
int pin12 = -1;
int pin13 = -1;
int pin14 = -1;
int pin15 = -1;
int flag = 0;
GPIO_Handle gpio_handle; /* handle para el GPIO */
//Configuración de los registros del GPIO
GPIO_Config gpio_config = {
0x00000000, // gpgc = Modo Passthrough de Interrupciones y control directo sobre GP0
0x0000FFFF, // gpen = Todos los pines de GPIO de 0 a 15 habilitados
0x00000000, // gdir = Todos los pines de GPIO como entradas
0x00000000, // gpval = Guarda el nivel lógico de los pines
0x00000000, // gphm all interrupts disabled for io pins
0x00000000, // gplm all interrupts to cpu or edma disabled
0x00000000 // gppol -- default state */
};
void leerDatosIzq();
void leerDatosDer();
void main() {
IRQ_globalDisable();
DSK6713_init();
DSK6713_LED_init();
gpio_handle = GPIO_open( GPIO_DEV0, GPIO_OPEN_RESET );
GPIO_config(gpio_handle,&gpio_config);
IRQ_map(IRQ_EVT_EXTINT7, 7);
IRQ_map(IRQ_EVT_EXTINT6, 6);
IRQ_reset(IRQ_EVT_EXTINT7);
IRQ_reset(IRQ_EVT_EXTINT6);
IRQ_globalEnable();
IRQ_nmiEnable();
IRQ_enable(IRQ_EVT_EXTINT7);
IRQ_enable(IRQ_EVT_EXTINT6);
while (1) {
DSK6713_LED_on(0);
DSK6713_LED_off(3);
if (flag == 1) {
printf("\nPIN 8 --> %d\n", pin8);
printf("\nPIN 9 --> %d\n", pin9);
printf("\nPIN 10 --> %d\n", pin10);
printf("\nPIN 11 --> %d\n", pin11);
printf("\nPIN 12 --> %d\n", pin12);
printf("\nPIN 13 --> %d\n", pin13);
printf("\nPIN 14 --> %d\n", pin14);
printf("\nPIN 15 --> %d\n", pin15);
flag = 0;
}
}
}
void leerDatosIzq(){
pin8 = GPIO_pinRead (gpio_handle,GPIO_PIN8);
pin9 = GPIO_pinRead (gpio_handle,GPIO_PIN9);
pin10 = GPIO_pinRead (gpio_handle,GPIO_PIN10);
pin11 = GPIO_pinRead (gpio_handle,GPIO_PIN11);
pin12 = GPIO_pinRead (gpio_handle,GPIO_PIN12);
pin13 = GPIO_pinRead (gpio_handle,GPIO_PIN13);
pin14 = GPIO_pinRead (gpio_handle,GPIO_PIN14);
pin15 = GPIO_pinRead (gpio_handle,GPIO_PIN15);
DSK6713_LED_off(0);
DSK6713_LED_on(3);
flag = 1;
}
void leerDatosDer(){
pin8 = GPIO_pinRead (gpio_handle,GPIO_PIN8);
pin9 = GPIO_pinRead (gpio_handle,GPIO_PIN9);
pin10 = GPIO_pinRead (gpio_handle,GPIO_PIN10);
pin11 = GPIO_pinRead (gpio_handle,GPIO_PIN11);
pin12 = GPIO_pinRead (gpio_handle,GPIO_PIN12);
pin13 = GPIO_pinRead (gpio_handle,GPIO_PIN13);
pin14 = GPIO_pinRead (gpio_handle,GPIO_PIN14);
pin15 = GPIO_pinRead (gpio_handle,GPIO_PIN15);
DSK6713_LED_off(0);
DSK6713_LED_on(3);
flag = 1;
}
The ISR's are assigned to the last two functions (leerDatosIzq and leerDatosDer) through the DSPBIOS's Hardware Interrupt Service Routine Manager. They are assigned to HWI_INT6 and HWI_INT7. They have no monitor assigned, the checkbox "Use Dispatcher" is selected. The Arg: is the default: 0x00000000 and the interrupt mask is "self".
I am using CCS 3.3.38.2 and DSP BIOS 5.31.02.
Thanks for your help.
Jorge Cifuentes