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.

OMAPL138 LCDK DSP GPIO

Other Parts Discussed in Thread: OMAPL138, SYSBIOS

I have written some simple code for ARM (all my code runs) and now I want to do the same things on the DSP.

Now I have written something (Some Codesnippets are from the examples from TI) but It don't work right.


The programm should write on the console a 0 when the Userbutton is pressed else it should stand a 1.

I can compile and run the code, but i dont hav e a 0/1 i always have 15730432...(On the Console at the Desktop - Putty)

later I want the LED also to be On/Off if the button is On/Off (Also in the code but at the moment // or /**/)

I have CSS 5.4, OMAPL138 LCDK and the code is NOT for SYSBIOS

Here is the source of it:

/**
 * \file  timerCounter.c
 *
 * \brief Sample application for timer.
 */
/* 		S2        GPIO2[4]	Button	S2
 *		S3        GPIO2[5]	Button	S3
 *		D3        GPIO1[6]	LED 	D3
 *		D4        GPIO1[7]	LED 	D4
 *
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
* .................................
*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "gpio.h"
#include "psc.h"

//For UART output
#include "uart.h"
#include "string.h"
#include "uartStdio.h"
#include "lcdkOMAPL138.h"
/* HW Macros */
#include "hw_types.h"
/* System Defines */
#include "lcdkOMAPL138.h"
#include "soc_OMAPL138.h"
#include "hw_syscfg0_OMAPL138.h"
/****************************************************************************/
/*                      GLOBAL VARIABLES                                    */
/****************************************************************************/
static volatile unsigned int pinValue = 0;

void PrintFError ( const char * format, ... )
{
  char buffer[256];
  va_list args;
  memset( buffer,0, sizeof(buffer));
  va_start (args, format);
  vsprintf (buffer,format, args);
  UARTPuts(buffer, -1);
  va_end (args);

}
void sys_debug( const char *const fmt, ... )
{
	PrintFError(fmt);
}
/*****************************************************************************
**                       PIN MULTIPLEXING
*****************************************************************************/
///* Pin Multiplexing of pin 4 of GPIO Bank 2.*/
void GPIOBank2Pin4PinMuxSetup(void)
{
     unsigned int savePinmux = 0;

     /* /brief
	 ** - SYSCFG0 SOC_SYSCFG_0_REGS  --> Memory-mapped registers for system confic module 0 (SYSCFG0) Fot Pinmultiplexing always use 0.
	 ** - PINMUX6 PINMUX(6)  --> Pin Multiplexing 6 Register - which register and for Pin xyz can be find in the datasheet on page 244.
	 ** - PINMUX6_15_12 PINMUX6_15_12_GPIO2_4 --> ...6_15_12 6 is The PINMUX register and 15_12 is the Corresponding 4bit field in the PINMUXn register
	 **   the 4 Bit field depends on the GPIO pin you can find the bit field in the datasheet on page 244.
     */

     /*
     ** Clearing the bit in context and retaining the other bit values
     ** in PINMUX6 register.
     */
     savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(6)) &
                  ~(SYSCFG_PINMUX6_PINMUX6_15_12));
     /* Setting the pins corresponding to GPIO2[4] in PINMUX6 register.*/
     HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(6)) = ( (SYSCFG_PINMUX6_PINMUX6_15_12_GPIO2_4  << SYSCFG_PINMUX6_PINMUX6_15_12_SHIFT) | savePinmux);
}
// Pin Multiplexing for the LED
void GPIOBank1Pin6PinMuxSetup(void)
{
    unsigned int savePinmux = 0;
    /*/brief
     * for details show "void GPIOBank2Pin4PinMuxSetup(void)"
    */
    savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(0)) &
                 ~(SYSCFG_PINMUX0_PINMUX0_27_24));

    HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(0)) = ( (SYSCFG_PINMUX0_PINMUX0_27_24_GPIO0_9  << SYSCFG_PINMUX0_PINMUX0_27_24_SHIFT) | savePinmux);

}

/*****************************************************************************
**                       			MAIN
*****************************************************************************/

int main(void)
{

	//for UART output
    UARTStdioInit();

	//...PSC is Power Sleep Controller
	PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON,   PSC_MDCTL_NEXT_ENABLE);

	  /* Pin Multiplexing of pin 4 of GPIO Bank 2.*/
	  GPIOBank2Pin4PinMuxSetup();
	  /* Pin Multiplexing of pin 6 of GPIO Bank 1.*/
	  //GPIOBank1Pin6PinMuxSetup();

	  /* Sets the pin 37(GP2[4]) as input.*/
	  GPIODirModeSet(SOC_GPIO_0_REGS, 37, GPIO_DIR_INPUT); //SOC_GPIO_0_REGS, 37 --> 37 is the pin - can be find in the datashees at page 900
	  /* Sets the pin 23 (GP1[6]) as output.*/
	  //GPIODirModeSet(SOC_GPIO_0_REGS, 10, GPIO_DIR_OUTPUT);

	  while( 1 )
	  {
		  pinValue = GPIOPinRead(SOC_GPIO_0_REGS, 37); //SOC_GPIO_0_REGS, 37 --> 37 is the pin to read. pin can be find in the datashees at page 900
		  sys_debug( "Pin high(1) or low(0): %i \n", pinValue); // UART Output
		  //GPIOPinWrite(SOC_GPIO_0_REGS, 10, pinValue); //Write pin Value (LOW or HIGH) to LED
	  }

	return 0;
}

Here is the .CMD

/****************************************************************************/
/*  OMAPL138.cmd                                                            */
/*  Copyright (c) 2010 Texas Instruments Incorporated                       */
/*  Author: Rafael de Souza                                                 */
/*                                                                          */
/*    Description: This file is a sample linker command file that can be    */
/*                 used for linking programs built with the C compiler and  */
/*                 running the resulting .out file on an OMAPL138           */
/*                 device.  Use it as a guideline.  You will want to        */
/*                 change the memory layout to match your specific          */
/*                 target system.  You may want to change the allocation    */
/*                 scheme according to the size of your program.            */
/*                                                                          */
/*    Usage:       The map below contains the local memory for each core    */
/*                 Use the linker option --define=DSP_CORE=n                */
/*                 Where n defines the core used: DSP (n=1) or ARM (n=0)    */
/*                                                                          */
/****************************************************************************/

MEMORY
{
#ifdef DSP_CORE      /* DSP exclusive memory regions */

    DSPL2ROM     o = 0x00700000  l = 0x00100000  /* 1MB L2 DSP local ROM */
    DSPL2RAM     o = 0x00800000  l = 0x00040000  /* 256kB L2 DSP local RAM */
    DSPL1PRAM    o = 0x00E00000  l = 0x00008000  /* 32kB L1 DSP local Program RAM */
    DSPL1DRAM    o = 0x00F00000  l = 0x00008000  /* 32kB L1 DSP local Data RAM */

#endif

    SHDSPL2ROM   o = 0x11700000  l = 0x00100000  /* 1MB L2 Shared Internal ROM */
    SHDSPL2RAM   o = 0x11800000  l = 0x00040000  /* 256kB L2 Shared Internal RAM */
    SHDSPL1PRAM  o = 0x11E00000  l = 0x00008000  /* 32kB L1 Shared Internal Program RAM */
    SHDSPL1DRAM  o = 0x11F00000  l = 0x00008000  /* 32kB L1 Shared Internal Data RAM */
    EMIFACS0     o = 0x40000000  l = 0x20000000  /* 512MB SDRAM Data (CS0) */
    EMIFACS2     o = 0x60000000  l = 0x02000000  /* 32MB Async Data (CS2) */
    EMIFACS3     o = 0x62000000  l = 0x02000000  /* 32MB Async Data (CS3) */
    EMIFACS4     o = 0x64000000  l = 0x02000000  /* 32MB Async Data (CS4) */
    EMIFACS5     o = 0x66000000  l = 0x02000000  /* 32MB Async Data (CS5) */
    SHRAM        o = 0x80000000  l = 0x00020000  /* 128kB Shared RAM */
    DDR2         o = 0xC0000000  l = 0x20000000  /* 512MB DDR2 Data */

#ifndef DSP_CORE     /* ARM exclusive memory regions */

    ARMROM       o = 0xFFFD0000  l = 0x00010000  /* 64kB ARM local ROM */
    ARMRAM       o = 0xFFFF0000  l = 0x00002000  /* 8kB ARM local RAM */

#endif
}

SECTIONS
{
    .text          >  SHRAM
    .stack         >  SHRAM
    .bss           >  SHRAM
    .cio           >  SHRAM
    .const         >  SHRAM
    .data          >  SHRAM
    .switch        >  SHRAM
    .sysmem        >  SHRAM
    .far           >  SHRAM
    .args          >  SHRAM
    .ppinfo        >  SHRAM
    .ppdata        >  SHRAM
    
    /* TI-ABI or COFF sections */
    .pinit         >  SHRAM
    .cinit         >  SHRAM
    
    /* EABI sections */
    .binit         >  SHRAM
    .init_array    >  SHRAM
    .neardata      >  SHRAM
    .fardata       >  SHRAM
    .rodata        >  SHRAM
    .c6xabi.exidx  >  SHRAM
    .c6xabi.extab  >  SHRAM
}

 Hope Someone can  me help.


Sorry for my bad english...


Greetz Fernando

  • Hi Greetz,

    Have a try the following code.

    /**
    * \file    gpio_switches_leds.c
    *
    * \brief   This is a sample application file demonstrating the use of
    *          a GPIO pin for input and output
    *
    *
    * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 
    *
    *  Redistribution and use in source and binary forms, with or without 
    *  modification, are permitted provided that the following conditions 
    *  are met:
    *
    *    Redistributions of source code must retain the above copyright 
    *    notice, this list of conditions and the following disclaimer.
    *
    *    Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in the 
    *    documentation and/or other materials provided with the   
    *    distribution.
    *
    *    Neither the name of Texas Instruments Incorporated nor the names of
    *    its contributors may be used to endorse or promote products derived
    *    from this software without specific prior written permission.
    *
    *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    
    #include<stdio.h>
    
    #include "gpio.h"
    #include "psc.h"
    
    #include "soc_OMAPL138.h"
    #include "lcdkOMAPL138.h"
    
    /* HW Macros */
    #include "hw_types.h"
    
    /* System Defines */
    #include "lcdkOMAPL138.h"
    #include "soc_OMAPL138.h"
    #include "hw_syscfg0_OMAPL138.h"
    
    
    
    /* Switch Configuration */
    
    /* Titus : GP0[1] to GP0[4] is mapped to SW1[3:4] on OMAPL138/C6748 LCDK boards */
    
    /* Pin Multiplexing bit mask to select GP0[1] to GP0[4] pin. */
    
    #define PINMUX1_GPIO0_1_ENABLE    (SYSCFG_PINMUX1_PINMUX1_27_24_GPIO0_1  << \
                                        SYSCFG_PINMUX1_PINMUX1_27_24_SHIFT)
    
    #define PINMUX1_GPIO0_2_ENABLE    (SYSCFG_PINMUX1_PINMUX1_23_20_GPIO0_2  << \
                                        SYSCFG_PINMUX1_PINMUX1_23_20_SHIFT)
    
    #define PINMUX1_GPIO0_3_ENABLE    (SYSCFG_PINMUX1_PINMUX1_19_16_GPIO0_3  << \
                                        SYSCFG_PINMUX1_PINMUX1_19_16_SHIFT)
    
    #define PINMUX1_GPIO0_4_ENABLE    (SYSCFG_PINMUX1_PINMUX1_15_12_GPIO0_4  << \
                                        SYSCFG_PINMUX1_PINMUX1_15_12_SHIFT)
    
    
    /* LED Configuration */
    
    /* Titus : GP6[12], GP6[13], GP2[12] and GP0[9] is mapped to D4, D5, D6, D7 LEDs on OMAPL138/C6748 LCDK boards */
    
    /* Pin Multiplexing bit mask to select GP6[12] pin. */
    #define PINMUX13_GPIO6_12_ENABLE    (SYSCFG_PINMUX13_PINMUX13_15_12_GPIO6_12  << \
                                        SYSCFG_PINMUX13_PINMUX13_15_12_SHIFT)
    
    /* Pin Multiplexing bit mask to select GP6[13] pin. */
    #define PINMUX13_GPIO6_13_ENABLE    (SYSCFG_PINMUX13_PINMUX13_11_8_GPIO6_13  << \
                                        SYSCFG_PINMUX13_PINMUX13_11_8_SHIFT)
    
    /* Pin Multiplexing bit mask to select GP2[12] pin. */
    #define PINMUX5_GPIO2_12_ENABLE    (SYSCFG_PINMUX5_PINMUX5_15_12_GPIO2_12  << \
                                        SYSCFG_PINMUX5_PINMUX5_15_12_SHIFT)
    
    /* Pin Multiplexing bit mask to select GP0[9] pin. */
    #define PINMUX0_GPIO0_9_ENABLE    (SYSCFG_PINMUX0_PINMUX0_27_24_GPIO0_9  << \
                                        SYSCFG_PINMUX0_PINMUX0_27_24_SHIFT)
    
    
    void PinMuxSetup_leds(void)
    {
         unsigned int savePinmux = 0;
    
    
         /*
         ** Clearing the bit in context and retaining the other bit values
         ** in PINMUX13 register.
         */
         savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(13)) &
                      ~(SYSCFG_PINMUX13_PINMUX13_15_12));
    
         /* Setting the pins corresponding to GP6[12] in PINMUX13 register.*/
         HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(13)) =
              (PINMUX13_GPIO6_12_ENABLE | savePinmux);
    
    
         /*
         ** Clearing the bit in context and retaining the other bit values
         ** in PINMUX13 register.
         */
         savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(13)) &
                      ~(SYSCFG_PINMUX13_PINMUX13_11_8));
    
         /* Setting the pins corresponding to GP6[13] in PINMUX13 register.*/
         HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(13)) =
              (PINMUX13_GPIO6_13_ENABLE | savePinmux);
    
    
         /*
         ** Clearing the bit in context and retaining the other bit values
         ** in PINMUX5 register.
         */
         savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(5)) &
                      ~(SYSCFG_PINMUX5_PINMUX5_15_12));
    
         /* Setting the pins corresponding to GP2[12] in PINMUX5 register.*/
         HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(5)) =
              (PINMUX5_GPIO2_12_ENABLE | savePinmux);
    
    
         /*
         ** Clearing the bit in context and retaining the other bit values
         ** in PINMUX0 register.
         */
         savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(0)) &
                      ~(SYSCFG_PINMUX0_PINMUX0_27_24));
    
         /* Setting the pins corresponding to GP0[9] in PINMUX0 register.*/
         HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(0)) =
              (PINMUX0_GPIO0_9_ENABLE | savePinmux);
    
    }
    
    
    
    void PinMuxSetup_switches(void)
    {
         unsigned int savePinmux = 0;
    
         /* Setting the pins corresponding to GP0[1] in PINMUX1 register.*/
    
         /*
         ** Clearing the bit in context and retaining the other bit values
         ** in PINMUX1 register.
         */
         savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) &
                      ~(SYSCFG_PINMUX1_PINMUX1_27_24));
    
    
         HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) =
              (PINMUX1_GPIO0_1_ENABLE | savePinmux);
    
    
    
         /* Setting the pins corresponding to GP0[2] in PINMUX1 register.*/
    
              /*
              ** Clearing the bit in context and retaining the other bit values
              ** in PINMUX1 register.
              */
              savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) &
                           ~(SYSCFG_PINMUX1_PINMUX1_23_20));
    
    
              HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) =
                   (PINMUX1_GPIO0_2_ENABLE | savePinmux);
    
    
    
    
              /* Setting the pins corresponding to GP0[3] in PINMUX1 register.*/
    
                   /*
                   ** Clearing the bit in context and retaining the other bit values
                   ** in PINMUX1 register.
                   */
                   savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) &
                                ~(SYSCFG_PINMUX1_PINMUX1_19_16));
    
    
                   HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) =
                        (PINMUX1_GPIO0_3_ENABLE | savePinmux);
    
    
    
                   /* Setting the pins corresponding to GP0[4] in PINMUX1 register.*/
    
                        /*
                        ** Clearing the bit in context and retaining the other bit values
                        ** in PINMUX1 register.
                        */
                        savePinmux = (HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) &
                                     ~(SYSCFG_PINMUX1_PINMUX1_15_12));
    
    
                        HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(1)) =
                             (PINMUX1_GPIO0_4_ENABLE | savePinmux);
    
    
    }
    
    
    int main(void)
    {
    
    
        /* The Local PSC number for GPIO is 3. GPIO belongs to PSC1 module.*/
        PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON,
    		     PSC_MDCTL_NEXT_ENABLE);
    
    
        /* Pin Multiplexing of pins GP0[1] to GP0[4] of GPIO Bank 2 for DIP SWITCHEs in OMAPL138 LCDK board */
        PinMuxSetup_switches();
    
        /* Pin Multiplexing of pins GP6[12], GP6[13], GP2[12], GP0[9], for LEDs in OMAPL138 LCDK board */
        PinMuxSetup_leds();
    
    
        /* Titus : 2,3,4,5 is the GPIO no for GP0[1] to GP0[4]; Refer page no 901 in OMAPL138/C6748 TRM */
    
    
    /* SWITCHEs SETUP */
    
        /* Sets the pin 2 (GP0[1]) as input.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 2, GPIO_DIR_INPUT);
    
        /* Sets the pin 3 (GP0[2]) as input.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 3, GPIO_DIR_INPUT);
    
        /* Sets the pin 4 (GP0[3]) as input.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 4, GPIO_DIR_INPUT);
    
        /* Sets the pin 5 (GP0[4]) as input.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 5, GPIO_DIR_INPUT);
    
    /* LEDs SETUP */
    
        /* Sets the pin 109 (GP6[12]) as output.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 109, GPIO_DIR_OUTPUT);
    
        /* Sets the pin 110 (GP6[13]) as output.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 110, GPIO_DIR_OUTPUT);
    
        /* Sets the pin 45 (GP2[12]) as output.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 45, GPIO_DIR_OUTPUT);
    
        /* Sets the pin 10 (GP0[9]) as output.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 10, GPIO_DIR_OUTPUT);
    
    
        while(1)
        {
    
        /* Titus : 2,3,4,5 is the GPIO no for GP0[1] to GP0[4]; Refer page no 901 in OMAPL138/C6748 TRM */
    
    	    if (GPIOPinRead(SOC_GPIO_0_REGS, 2))
    		{
    
    		GPIOPinWrite(SOC_GPIO_0_REGS, 109, GPIO_PIN_LOW);
        	printf("S1 is not pressed\n");
    
    		}
    
    	    else
    	    {
    	    	printf("S1 is pressed\n");
    			GPIOPinWrite(SOC_GPIO_0_REGS, 109, GPIO_PIN_HIGH);
    
    	    }
    
    	    if (GPIOPinRead(SOC_GPIO_0_REGS, 3))
    		{
    
    		GPIOPinWrite(SOC_GPIO_0_REGS, 110, GPIO_PIN_LOW);
        	printf("S2 is not pressed\n");
    
    		}
    	    else
    	    	    {
    	    	    	printf("S2 is pressed\n");
    	    			GPIOPinWrite(SOC_GPIO_0_REGS, 110, GPIO_PIN_HIGH);
    
    	    	    }
    
    
    	    if (GPIOPinRead(SOC_GPIO_0_REGS, 4))
    		{
    
    		GPIOPinWrite(SOC_GPIO_0_REGS, 45, GPIO_PIN_LOW);
        	printf("S3 is not pressed\n");
    
    		}
    	    else
    	    	    {
    	    	    	printf("S3 is pressed\n");
    	    			GPIOPinWrite(SOC_GPIO_0_REGS, 45, GPIO_PIN_HIGH);
    
    	    	    }
    
    
    	    if (GPIOPinRead(SOC_GPIO_0_REGS, 5))
    		{
    
    		GPIOPinWrite(SOC_GPIO_0_REGS, 10, GPIO_PIN_LOW);
        	printf("S4 is not pressed\n");
    
    
    		}
    	    else
    	    	    {
    	    	    	printf("S4 is pressed\n");
    	    			GPIOPinWrite(SOC_GPIO_0_REGS, 10, GPIO_PIN_HIGH);
    
    	    	    }
    
    
    
        }
    
    
    }
    

  • Thanks! It works even if you gave me a source who uses the Switch bank and not the Buttons, but I think that can I manage by myself :)

    Thanks and have a nice day!


    Regards, Fernando

  • Hi Greetz,

    Sounds good.

    Thanks for your update.

  • Titus,

    Sorry I am re intiating this closed thread. But I tried the code above. The switch status is detected and printed out in the console. But the LEDs do not change correspondingly.  What could be the issue. 

    thanks

    Vivek

  • Dear Vivek,

    Did you create a new project with this code ?

    I would like you to suggest to use the above code in the following starterware example (just copy & paste) as all the required libraries available and linked into that project, then rebuild the code, it should work.
    Its tested one.

    Please try that and let me know.
  • Yes Titus,

    I created a new project and added the code. Which project are you talking about? The GPIO starterware one? I am going to try on that. I'll let you know.

    Btw as a continuation of last post: I had the corresponding GPIOs for the LEDs toggling in the debug register window, but not on the real H/W. This has happened to me many times with other codes also. What could be the main reason for this?

    thanks

    Vivek

  • Dear Vivek,
    Yes, I meant starterware GPIO example only, actually forgot to add the location of the GPIO example code.


    Btw as a continuation of last post: I had the corresponding GPIOs for the LEDs toggling in the debug register window, but not on the real H/W. This has happened to me many times with other codes also. What could be the main reason for this?

    If you don't have a real LEDs board, then you can check the GPIO IN and OUT registers via register window while running the code.

    Are you working with custom board or LCDK board ?
  • Titus,

    Like you said, I copied this code into gpio_arm starterware example (and excluded my original gpio.c from building in CCS). And I didnt change anything else. It was then that I got this "Data Verification error". So I changed my original GPIO.cmd file to omapl138.cmd linker file by changing the device in build settings from "Generic ARM9 device" to "OMAPL138LCDK". This resolved the data verification error, and I was able to debug the code. But I was still not getting the LEDs to blink on H/W. (They do toggle in software). What could be the issue? pls help

    Vivek

  • I am working with the LCDK board. and yes I can see all 4 LEDs toggling in the register window but not in H/W. This happens only when I need to pinmux. The basic gpio example works fine because of the built in pinmux function that comes with lcdk library. but when i try to do pinmux myself it doesnt work.
  • I think, you are working with ARM project.
    I have experience the similar issue.
    If so, you must use "system_config.lib" in your project.

    Refer to the following e2e posts.
    e2e.ti.com/.../1553176
    e2e.ti.com/.../1205114
  • Thanks a lot titus. I got the code working.

    The data verification error was resolved when I added GEL files for ARM and DSP each to my launch configuration.

    thanks again
    You're Awesome!
    p.s: I'll need your help again soon.

  • Dear Vivek,
    Glad to hear that you were able to solve the problem.
    Thanks for your update.
  • Hi Titus,


    I was trying to run the program that you posted above, but i don't know where are this include files:
    #include "gpio.h"
    #include "psc.h"

    #include "soc_OMAPL138.h"
    #include "lcdkOMAPL138.h"

    /* HW Macros */
    #include "hw_types.h"

    /* System Defines */
    #include "lcdkOMAPL138.h"
    #include "soc_OMAPL138.h"
    #include "hw_syscfg0_OMAPL138.h"

    Where can i found them? If i paste that includes on the same folder of the program file and compile using arm-arago-linux-gnueabi-gcca with ti-sdk-omapl138-lcdk-01.00.00 it will work?
    This kind of code runs on omap l-138 lcdk with the linux kernel 3.3.0?

    Thanks,
    Pedro

  • Hello Titus,

    Sorry to interrupt all of you. I am currently trying to toggle GPIO6Pin12 which is D5 on LCDKOMAPL138 using ARM core. I tried the same using DSP but failed. Now, I want the same to work on ARM core. Remember, I have made separate projects for both ARM and DSP cores but DSP core has successfully toggled the D5 but ARM can't physcially. I copied the same code in ARM core project from DSP core project. Also registers shows the toggled state of GPIO6Pin12 in ARM core.
    Thanks.