DSPRelated.com
Forums

C6713DSK GPIO problem, please help

Started by sh13...@yahoo.com January 25, 2007
Hi

I am new to DSP programming, please help me. I had a lot of troubles using GPIOs to generate interrupts, finally I decided just check my input pins with a very simple program. I tried many configurations for setting up the GPIOs as input, but regardless of the real input, I always get ONE from the input pins. I tried all input pins and I also tried to define the pin properties in many different ways but regardless, I my board always read ONE from the input pin. Can anybody kindly post a sample program for setting up GPIOs as inputs for C6713DSK. I really appreciate it. This is one of the ways that I tried to read input pins.
#include
#include
#include

GPIO_Handle hGpio;
int pin4_value;

void main()
{
CSL_init();
hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
GPIO_pinEnable(hGpio,GPIO_PIN4);
GPIO_pinDirection(hGpio, GPIO_PIN4,GPIO_INPUT);

for(;;)
{ pin4_value = GPIO_pinRead (hGpio,GPIO_PIN4);
printf ("Pin4: %d\n",pin4_value);
}
}
Thanks for your help in advance.
Shamim
Shamin-

> I am new to DSP programming, please help me. I had a lot of troubles
> using GPIOs to generate interrupts,

Pins configured as GPIO won't generate interrupts. You have to configure pins as
EINT (external interrupt). Only certain pins allow this, for example EINT4 through
EINT7.

> finally I decided just check my input pins with a very simple program. I
> tried many configurations for setting up the GPIOs as input, but
> regardless of the real input, I always get ONE from the input pins.
> I tried all input pins and I also tried to define the pin properties
> in many different ways but regardless, I my board always read ONE from
> the input pin. Can anybody kindly post a sample program for setting up
> GPIOs as inputs for C6713DSK. I really appreciate it. This is one of
> the ways that I tried to read input pins.

At first glance, your code below should work. Did you make absolutely sure that if
you measure the pin right at the DSP (or as close as you can get in the DSK card) the
value is actually zero? And you are holding the value as zero? If the value is
changing, using printf() statement will not be fast enough to "see" it.

-Jeff

> #include
> #include
> #include GPIO_Handle hGpio;
> int pin4_value;
>
> void main()
> {
> CSL_init();
> hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
> GPIO_pinEnable(hGpio,GPIO_PIN4);
> GPIO_pinDirection(hGpio, GPIO_PIN4,GPIO_INPUT);
>
> for(;;)
> { pin4_value = GPIO_pinRead (hGpio,GPIO_PIN4);
> printf ("Pin4: %d\n",pin4_value);
> }
> }
>
> Thanks for your help in advance.
> Shamim