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.

Problem about GOIO

Other Parts Discussed in Thread: SPRC090

this is a  program which is to change the clectirc level of the pin 13 of GPIO ;

no error was reported .from the CCS.but the clectirc level of the pin 13 of GPIO cannont be changed. i have 

tried  many  methods but cannot work.   You can write a program to achieve the same function .I wii be very thankful .

#include <c6x.h>


void delay(unsigned int i)
{
while(i--);
}
void main()
{
*(unsigned int *)0x01B00000 |=1<<13;//使能G PIO 13
*(unsigned int *)0x01B00004|=1<<13;// 设定GPIO13 为输出
while(1)
{
*(unsigned int *)0x01B00008 &=~(1<<13);//输出低电平
delay(0xffff);
// *(unsigned int *)0x01B00008|=1<<13;//输出高电平
// delay(0xffff);
}
}

  • c6713 

    this is a  program which is to change the clectirc level of the pin 13 of GPIO ;

    no error was reported .from the CCS.but the clectirc level of the pin 13 of GPIO cannont be changed. i have

    tried  many  methods but cannot work.   You can write a program to achieve the same function .I wii be very thankful .

    #include <c6x.h>


    void delay(unsigned int i)
    {
    while(i--);
    }
    void main()
    {
    *(unsigned int *)0x01B00000 |=1<<13;//使能G PIO 13 
    *(unsigned int *)0x01B00004|=1<<13;// 设定GPIO13 为输出
    while(1)
    {
    *(unsigned int *)0x01B00008 &=~(1<<13);//输出低电平
    delay(0xffff);
    // *(unsigned int *)0x01B00008|=1<<13;//输出高电平
    // delay(0xffff);
    }
    }

  • Hi GAOSONG LI,

    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. Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics.

    Please refer the following links which talks about the configuration and the programming sequence of GPIO.

    http://processors.wiki.ti.com/index.php/Configuring_GPIO_Interrupts#GPIO_Configuration

    http://processors.wiki.ti.com/index.php/StarterWare_GPIO

    If interested in sample codes, you can have a reference of C6748 gpio driver code or gpio example code enclosed in starterware package of "C6748_StarterWare_1_20_03_03" as the sample code could not be found for C6713.

    Other relative Forum threads which might be of some use:

    http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115/t/46560.aspx

    http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115/p/47128/166774.aspx#166774

    Regards,

    Shankari

     

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

  • No experience with the C6713. Some guesses. I don't think the Starterware GPIO code will help. It supports the C6748 which is totally incompatible with the C6713. The TMS320C6000 Chip Support Library might be better reference for example code. See:
    http://www.ti.com/tool/sprc090

    I think your code needs some "volatile"s. The compiler is likely optimizing out your loops and register accesses. Something like this:

    #include <c6x.h>

    #define GPEN  *(volatile unsigned int *)0x01B00000
    #define GPDIR *(volatile unsigned int *)0x01B00004
    #define GPVAL *(volatile unsigned int *)0x01B00008
    #define GPDH  *(volatile unsigned int *)0x01B00010
    #define GPDL  *(volatile unsigned int *)0x01B00014
    #define GPHM  *(volatile unsigned int *)0x01B00018
    #define GPLM  *(volatile unsigned int *)0x01B0001C
    #define GPGC  *(volatile unsigned int *)0x01B00020
    #define GPPOL *(volatile unsigned int *)0x01B00024

    void delay(volatile unsigned int i)
    {
      while(i--);
    }

    void main()
    {
      GPEN  |=1<<13;// Enable GP13
      GPDIR |=1<<13;// Set GP13 as output
      while(1)
      {
        GPVAL &= ~(1<<13); // Set GP13 to 0
        delay(0xffff);
        GPVAL |=  (1<<13); // Set GP13 to 1
        delay(0xffff);
      }
    }