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.

TMS320C6678: Testing GPIOS on TMDSEVM6678L

Part Number: TMS320C6678

Dear all,

I must be too clumsy, but I'm not succeeding and maybe you can help me. I think is a very simple question but for the moment  I am not able go on.

I am trying to test GPIOs on TMDSEVM6678L using my  own program. I would like to switch on/off GPIO15, which is on pin 80 of the connector TEST_PH1. With a polimeter in that pin,  I am able to see if this GPIO switch.

The program I am using is the same as the "UART_BasicExample_C6678_C66xExampleProject" with minor modifications, basically I have added the lines to toggle GPIO15 and the includes I think are needed.

This is the full program:

***********************************************

#include "stdio.h"
#include "stdint.h"
#include "stdlib.h"
#include "string.h"

/* CSL Header files */
#include <ti/csl/csl_chip.h>


/* UART Header files */
#include <ti/drv/uart/UART.h>
#include <ti/drv/uart/UART_stdio.h>

#include <ti/drv/uart/test/src/UART_board.h>


#include <ti/csl/soc.h>
#include <ti/csl/hw_types.h>

/* TI-RTOS Header files */
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>

#include <ti/board/board.h>

#include "GPIO_log.h"
#include "GPIO_board.h"



 /* Length of the input in number of characters */
#define INPUT_LENGTH           (16U)

char echoPrompt[]="\nuart driver and utils example test cases :\nEnter 150 characters or press the esc \n";
char echoPrompt1[]="DATA RECEIVED IS\n ";


/**********************************************************************
 ************************** Macros ************************************
 **********************************************************************/
#define DELAY_VALUE       (500U)   /* 500 msec */

/**********************************************************************
 ************************** Internal functions ************************
 **********************************************************************/

/* Delay function */
void AppDelay(unsigned int delayVal);

void Gpio_appC7xPreInit(void);

void Board_initUART(void)
{
    Board_initCfg boardCfg;
    GPIO_v0_HwAttrs gpio_cfg;
    GPIO_socGetInitCfg(15, &gpio_cfg);

    boardCfg = BOARD_INIT_MODULE_CLOCK |
               BOARD_INIT_UART_STDIO;

    Board_init(boardCfg);
}

//////////////////////////////////
//////////////////////////////////
void main()

{
    char input = '\n';
    char *buffPointer;


    Board_initUART();

    buffPointer = (char*)malloc(INPUT_LENGTH);
    memset(buffPointer,0,INPUT_LENGTH);

    UART_puts("\nuart driver and utils example test cases :\nEnter 16 characters or press the esc \n",sizeof("uart driver and utils example test cases : please enter 16 characters or press the esc or carriage return\n"));


        memset(buffPointer,0,INPUT_LENGTH);
        UART_gets(buffPointer, INPUT_LENGTH);
        UART_puts(&input,1);
        UART_printf("Data received is\n");
        UART_puts(buffPointer, INPUT_LENGTH);
        UART_printStatus("\nTest Passed\n");
        UART_puts("\nuart driver and utils example test cases :\nEnter 16 characters or press the esc \n",sizeof("uart driver and utils example test cases : please enter 16 characters or press the esc or carriage return\n"));

        UART_puts("\nGPIO15 Test \n",sizeof("GPIO15 Test\n"));
        GPIO_write(15, GPIO_PIN_VAL_HIGH);
        AppDelay(DELAY_VALUE);
        GPIO_write(15, GPIO_PIN_VAL_LOW);
        AppDelay(DELAY_VALUE);

} /* uart_test */

/*
 *  ======== AppDelay ========
 */
void AppDelay(unsigned int delayVal)
{
    Osal_delay(delayVal);
}

*********************************************************

Next picture are the includes:

When building I get:

error #10234-D: unresolved symbols remain

I have tried many things but without succeed.

Doy you have an idea what I miss?

Are the lines to switch on/off the GPIO15 correct? Do I need anything else?

If you need any further information please let me know.

Thanks in advance,

Joaquin.

  • Joaquin,

    Toggling LED code already exists as a part of Platform test code of Processor SDK 6.3.

    Search the text, "test_led" in platforms_utils_test.c

    Follow the steps given here to run the platform test code : [FAQ] TMS320C6678: How to build and run the platform test on C6678 EVM ? - Processors forum - Processors - TI E2E support forums

    ---

    It is always good to start with something which was already working.

    --

    When building I get:

    error #10234-D: unresolved symbols remain

    You have not added the error screenshot here.

    More over this message states that it is a linker error.

    --

    If you want the simple and direct GPIO toggle code, here you go


    #define GPIO_BASE (0x2320000)
    #define GPIO_DIR_OFFSET (0x10)
    #define GPIO_SETDATA_OFFSET (0x18)
    #define GPIO_CLEARDATA_OFFSET (0x1C)

    void main(void)
    {

    volatile uint32_t *reg_val;

    reg_val = (volatile uint32_t *)(GPIO_BASE + GPIO_DIR_OFFSET);
    // configure as output pin -- write 0 to the Direction register
    *reg_val &= ~ (1 << 8);

    While (1)

    {

    reg_val = (volatile uint32_t *) (GPIO_BASE + GPIO_SETDATA_OFFSET);
    // Write value 1 in the set data register, so that Out data register will be 1. GPIO PIN - high
    *reg_val |= (1 << 8);

    // delay 

    for (i = 0; i < 1000000; i++)
    {}

    reg_val = (volatile uint32_t *) (GPIO_BASE + GPIO_CLEARDATA_OFFSET );
    // Write value 1 in the clear data register, so that Out data register will be 0. GPIO PIN - LOW
    *reg_val |= (1 << 8);

    // delay 

    for (i = 0; i < 1000000; i++)
    {}

            }
    }

    Regards

    Shankari G

  • Hi Shankari,

    Thank you again for your great support.

    Yes, I have run the Platform test and it works. But it is a too complex software regarding what I want to do because it has many includes and relationships between different parts, and although I tryied to custom it to my simple tests, I did not succeed.

    Thank you again.

    Regards,

    Joaquin

  • Joaquin,

    Use the following code.

    This is a simple direct code on GPIO.

    ============================

    #define GPIO_BASE (0x2320000)
    #define GPIO_DIR_OFFSET (0x10)
    #define GPIO_SETDATA_OFFSET (0x18)
    #define GPIO_CLEARDATA_OFFSET (0x1C)

    void main(void)
    {

    volatile uint32_t *reg_val;

    uint32_t i = 0;

    reg_val = (volatile uint32_t *)(GPIO_BASE + GPIO_DIR_OFFSET);
    // configure as output pin -- write 0 to the Direction register
    *reg_val &= ~ (1 << 8);

    While (1)

    {

    reg_val = (volatile uint32_t *) (GPIO_BASE + GPIO_SETDATA_OFFSET);
    // Write value 1 in the set data register, so that Out data register will be 1. GPIO PIN - high
    *reg_val |= (1 << 8);

    // delay 

    for (i = 0; i < 1000000; i++)
    {}

    reg_val = (volatile uint32_t *) (GPIO_BASE + GPIO_CLEARDATA_OFFSET );
    // Write value 1 in the clear data register, so that Out data register will be 0. GPIO PIN - LOW
    *reg_val |= (1 << 8);

    // delay 

    for (i = 0; i < 1000000; i++)
    {}

     }

    }

    Regards

    Shankari G