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 IN C6713 NOT WORKING

Hi,

I wrote this code to configure the GPIO ports of c6713. I made port 15 (GPO3 PIN) as input. The code was to toggle led(0) when ever gpo pin3 reads signal 1.

I gave a 3.3v input signal. But i dont see any thing happening .

Kindly suggest what is happening. I also pulled down the resistor by switching on dip switch 3 to ON.

// GPIO.c UPIITA-IPN
// JOSE DAVID VALENCIA PESQUEIRA
//
// THIS PROGRAM ALLOWS THE DSP TO SEND A BIT THROUGH A GPIO PIN (PIN 7 IN THIS EXAMPLE)
// TO TURN ON A LED ON

#include <stdio.h>
#include <stdlib.h>
#include <csl_gpio.h>
#include <csl_gpiohal.h>
#include <csl_irq.h>

// CODE TO DEFINE GPIO HANDLE
GPIO_Handle gpio_handle;

// GPIO REGISTER CONFIGURATION
GPIO_Config gpio_config = {
0x00000000, // gpgc = Interruption passthrough mode
0x0000FFFF, // gpen = All GPIO 0-15 pins enabled
0x00000000, // gdir = All GPIO pins as outputs
0x00000000, // gpval = Saves the logical states of pins
0x00000000, // gphm All interrupts disabled for IO pins
0x00000000, // gplm All interrupts for CPU EDMA disabled
0x00000000 // gppol -- default state */
};

// Function prototypes
void delay();

// Function definitions

{
DSK6713_init();
// Open and configure the GPIO
gpio_handle = GPIO_open( GPIO_DEV0, GPIO_OPEN_RESET );
GPIO_config(gpio_handle,&gpio_config);
// Send values through the pins

GPIO_pinRead(gpio_handle,GPIO_PIN3);

delay();

}

main()
{
while(1)
{
If (GPIO_PIN3 ==1)


DSK6713_LED_on(0);

else 

DSK6713_LED_off(0);
delay();

}
}

 

  • I got the code working to send output signal using gpo port 2.
    But i tried to read a signal at the port, but when i see the watch window, it doesn't show any thing. Have my code below.
    I gave a 3.3v signal to GPO2

    #include <stdio.h>
    #include <stdlib.h>
    #include <csl_gpio.h>
    #include <csl_gpiohal.h>
    #include <csl_irq.h>

    // CODE TO DEFINE GPIO HANDLE
    GPIO_Handle gpio_handle;

    // GPIO REGISTER CONFIGURATION
    GPIO_Config gpio_config = {
    0x00000000, // gpgc = Interruption passthrough mode
    0x0000FFFF, // gpen = All GPIO 0-15 pins enabled
    0x00000000, // gdir = All GPIO pins as inputs
    0x00000000, // gpval = Saves the logical states of pins
    0x00000000, // gphm All interrupts disabled for IO pins
    0x00000000, // gplm All interrupts for CPU EDMA disabled
    0x00000000 // gppol -- default state */
    };

    // Function prototypes
    void delay();

    // Function definitions

    {
    DSK6713_init();
    // Open and configure the GPIO
    gpio_handle = GPIO_open( GPIO_DEV0, GPIO_OPEN_RESET );
    GPIO_config(gpio_handle,&gpio_config);
    // Send values through the pins

    GPIO_pinRead(gpio_handle,GPIO_PIN2);

    delay();
    X = GPIO_PIN2;

    }

    main()
    {
    while(1)
    {
    send_edge();
    DSK6713_LED_toggle(1);
    delay();

    }
    }
  • Hi Venkat,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com).

    I will recommend you first do hands-on with already working example projects, then you can modify them as per your requirement or can refer them to write your own developed codes.

    You can download BSL and CSL packages from below mentioned link,
    processors.wiki.ti.com/.../C6713DSK_in_CCSv5
  • Hi,

    I did went through the examples before i started. I had this code written only i had bit idea about the devices. 

    But still i am not sure why is the not possible to read data from GPIO using , where as i can WRITE Using similar code.

  • Venkat,

    Please post the working example that you went through, such as what Arvind mentioned and you confirmed. We can then help you compare the working code with your failing code.

    Regards,
    RandyP
  • Hi,
    I have been able to work only on port 80 (GPO Port 2). I have been unable to activate other ports.
  • Navaneeth,

    Why are you posting on this thread?

    If you are working with Venkat, please explain what you mean by "port 80".

    We still have outstanding questions of Venkat. If you can supply the example code that did work, then we can help to compare it with your own code that does not work.

    Theses devices and boards work well. The examples supplied with the boards work well. You will always want to see those working first, and then modify them to work how you want them to.

    Regards,
    RandyP
  • Port 80 of HPI Port(CLKOUT2/gpio port 2) .

    This is part of the code we used for GPIO to read .

    // GPIO REGISTER CONFIGURATION
    GPIO_Config gpio_config = {
    0x00000000, // gpgc = Interruption passthrough mode
    0x0000FFFF, // gpen = All GPIO 0-15 pins enabled
    0x00000000, // gdir = All GPIO pins as outputs
    0x00000000, // gpval = Saves the logical states of pins
    0x00000000, // gphm All interrupts disabled for IO pins
    0x00000000, // gplm All interrupts for CPU EDMA disabled
    0x00000000 // gppol -- default state */
    };

    void main()
    {
    DSK6713_AIC23_CodecHandle hCodec;
    // CODE TO DEFINE GPIO HANDLE
    GPIO_Handle gpio_handle;
    Int16 msec, sample, PIN2,Y;

    /* Initialize the board support library, must be called first */
    DSK6713_init();
    // Open and configure the GPIO
    gpio_handle = GPIO_open( GPIO_DEV0, GPIO_OPEN_RESET );
    GPIO_config(gpio_handle,&gpio_config);

    /* Start the codec */
    hCodec = DSK6713_AIC23_openCodec(0, &config);
    while(1)
    {
    PIN2=GPIO_pinRead(gpio_handle,GPIO_PIN2);
  • We got it working. Thanks for your supports guys
  • Navaneeth,

    Excellent news, and thanks for letting us know.

    When you have a chance, please post the code changes or snippets that made it work. That will help future readers who have the same or similar problems.

    Regards,
    RandyP