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.

Can't activated GPIO

Other Parts Discussed in Thread: OMAPL138, AM1808

Hi all,

I use OMAP l138 with the logicPD evm board. And I use CCs v5.1 with SYBIOS(6.32.05.54) and StarterWare(1.10.02.02).

I'm new in developping software on DSP, i'm trying to activated GPIO. It's supose to be simple... but its doesn't work. 

Here is my code i just try to activated the GPIO bank 0 pin 8 and GPIO bank 7 pin 12, when i verify in debug mode and with a multimeter the state of the GPIO they never change...

//-------------------------------------
// INCLUDES
//-------------------------------------

#include "main.h"
#include "gpio.h"
#include "soc_OMAPL138.h"

//--------------------------------------
// main()
//--------------------------------------
void main(void){

/* Sets the pin 9(GP0[8]) as output.*/
GPIODirModeSet(SOC_GPIO_0_REGS, 9, GPIO_DIR_OUTPUT);
/* Sets the pin 9(GP0[8]) to low.*/
GPIOPinWrite(SOC_GPIO_0_REGS, 9,GPIO_PIN_LOW);
/* Sets the pin 9(GP0[8]) as output.*/
GPIOPinWrite(SOC_GPIO_0_REGS, 9,GPIO_PIN_HIGH);

/* Sets the pin 9(GP7[12]) as output.*/
GPIODirModeSet(SOC_GPIO_0_REGS, 126, GPIO_DIR_OUTPUT);
/* Sets the pin 9(GP7[12]) to low.*/
GPIOPinWrite(SOC_GPIO_0_REGS, 126,GPIO_PIN_LOW);
/* Sets the pin 9(GP7[12]]) as output.*/
GPIOPinWrite(SOC_GPIO_0_REGS, 126,GPIO_PIN_HIGH);

BIOS_start(); // start the sysBIOS
}

Can't someone tell what i doing wrong?

Thanks
  • Just to clarify that i was able to run dip and led demo software on the evm LogicPD.

    I find in the wiki page this (http://processors.wiki.ti.com/index.php/StarterWare_GPIO_V2) so i modify my code like this:

    //-------------------------------------
    // INCLUDES
    //-------------------------------------

    #include "main.h"
    #include "gpio_v2.h"
    #include "hw_types.h"
    #include "soc_OMAPL138.h"

    //--------------------------------------
    // main()
    //--------------------------------------
    void main(void){

    GPIOModuleEnable(SOC_GPIO_0_REGS);
    GPIOModuleReset(SOC_GPIO_0_REGS);

    /* Sets the pin 9(GP0[8]) as output.*/
    GPIODirModeSet(SOC_GPIO_0_REGS, 9, GPIO_DIR_OUTPUT);
    /* Sets the pin 9(GP0[8]) to low.*/
    GPIOPinWrite(SOC_GPIO_0_REGS, 9,GPIO_PIN_LOW);
    /* Sets the pin 9(GP0[8]) as output.*/
    GPIOPinWrite(SOC_GPIO_0_REGS, 9,GPIO_PIN_HIGH);

    /* Sets the pin 9(GP7[12]) as output.*/
    GPIODirModeSet(SOC_GPIO_0_REGS, 126, GPIO_DIR_OUTPUT);
    /* Sets the pin 9(GP7[12]) to low.*/
    GPIOPinWrite(SOC_GPIO_0_REGS, 126,GPIO_PIN_LOW);
    /* Sets the pin 9(GP7[12]]) as output.*/
    GPIOPinWrite(SOC_GPIO_0_REGS, 126,GPIO_PIN_HIGH);

    BIOS_start(); // start the sysBIOS
    }
    but now i cant build my code because i got errors.
    **** Build of configuration Debug for project sysbios_DSP ****

    C:\ti\ccsv5\utils\bin\gmake -k -j2 all
    'Building file: ../app.cfg'
    'Invoking: XDCtools'
    "C:/ti/xdctools_3_22_04_46/xs" --xdcpath="C:/ti/bios_6_32_05_54/packages;C:/ti/ipc_1_23_05_40/packages;" xdc.tools.configuro -o configPkg -t ti.targets.elf.C674 -p ti.platforms.evmOMAPL138 -r debug -c "C:/ti/ccsv5/tools/compiler/c6000" --compileOptions "-g --optimize_with_debug" "../app.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring app.xe674 from package/cfg/app_pe674.cfg ...
    cle674 package/cfg/app_pe674.c ...
    'Finished building: ../app.cfg'
    ' '
    'Building file: ../DSP.c'
    'Building file: ../Globals.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/ti/ccsv5/tools/compiler/c6000/include" --include_path="C:/SYSBIOSv4/Labs/DSP_BSL/bsl/inc" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/c674x/omapl138" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/hw" --display_error_number --diag_warning=225 --abi=eabi --preproc_with_compile --preproc_dependency="DSP.pp" --cmd_file="./configPkg/compiler.opt" "../DSP.c"
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/ti/ccsv5/tools/compiler/c6000/include" --include_path="C:/SYSBIOSv4/Labs/DSP_BSL/bsl/inc" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/c674x/omapl138" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/hw" --display_error_number --diag_warning=225 --abi=eabi --preproc_with_compile --preproc_dependency="Globals.pp" --cmd_file="./configPkg/compiler.opt" "../Globals.c"
    'Finished building: ../Globals.c'
    ' '
    'Building file: ../SPI.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/ti/ccsv5/tools/compiler/c6000/include" --include_path="C:/SYSBIOSv4/Labs/DSP_BSL/bsl/inc" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/c674x/omapl138" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/hw" --display_error_number --diag_warning=225 --abi=eabi --preproc_with_compile --preproc_dependency="SPI.pp" --cmd_file="./configPkg/compiler.opt" "../SPI.c"
    "../SPI.c", line 161: warning #552-D: variable "CLK" was set but never used
    'Finished building: ../DSP.c'
    ' '
    'Building file: ../main.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/ti/ccsv5/tools/compiler/c6000/include" --include_path="C:/SYSBIOSv4/Labs/DSP_BSL/bsl/inc" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/c674x/omapl138" --include_path="C:/ti/OMAPL138_StarterWare_1_10_02_02/include/hw" --display_error_number --diag_warning=225 --abi=eabi --preproc_with_compile --preproc_dependency="main.pp" --cmd_file="./configPkg/compiler.opt" "../main.c"
    'Finished building: ../SPI.c'
    ' '
    'Finished building: ../main.c'
    ' '
    'Building target: sysbios_DSP.out'
    'Invoking: C6000 Linker'
    "C:/ti/ccsv5/tools/compiler/c6000/bin/cl6x" -mv6740 -g --display_error_number --diag_warning=225 --abi=eabi -z -m"sysbios_DSP.map" --warn_sections -i"C:/ti/ccsv5/tools/compiler/c6000/lib" -i"C:/ti/OMAPL138_StarterWare_1_10_02_02/binary/c674x/cgt/omapl138/drivers/Release" -i"C:/ti/OMAPL138_StarterWare_1_10_02_02/platform/evmOMAPL138" -i"C:/ti/ccsv5/tools/compiler/c6000/include" --reread_libs --rom_model -o "sysbios_DSP.out" -l"./configPkg/linker.cmd" "./main.obj" "./SPI.obj" "./Globals.obj" "./DSP.obj" -l"libc.a" -l"C:\ti\OMAPL138_StarterWare_1_10_02_02\binary\c674x\cgt\omapl138\drivers\Release\drivers.lib" "C:/ti/OMAPL138_StarterWare_1_10_02_02/binary/c674x/cgt/omapl138/drivers/Release/drivers.lib"
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    GPIOModuleEnable ./main.obj
    GPIOModuleReset ./main.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "sysbios_DSP.out" not built

    >> Compilation failure
    gmake: *** [sysbios_DSP.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    Please help me.
  • Hi Vincent,

    Vincent St-Pierre said:

    I find in the wiki page this (http://processors.wiki.ti.com/index.php/StarterWare_GPIO_V2) so i modify my code like this:

    This page refers to GPIO controller/peripheral found on AM335x. It is unrelated to OMAPL138 or AM1808. Refer here http://processors.wiki.ti.com/index.php/StarterWare_GPIO for your SoC.

    Vincent St-Pierre said:
    undefined first referenced
    symbol in file
    --------- ----------------
    GPIOModuleEnable ./main.obj
    GPIOModuleReset ./main.obj



    This is because these APIs are not defined in GPIO module (of OMAPL138). You are trying to use the GPIO V2 APIs, which are not part of OMAPL138. Use appropriate file.

    And, finally, coming to the main issue, that the GPIOs are not getting effected, did you d appropriate settings like pinmux etc?
    If not please refer to the GPIO specific platform file (in evmOMAPL138 directory) and get these settings right. It is too simple for your code to go wrong.

    Hope this helps.

    Regards,
    Madhvapathi Sriram
  • Hello Vincent,

    Sriram was right in highlighting that :

    • An incorrect user guide was referred to.
    • Certain system and platform specific configurations were not done before using GPIO.

    The following suggestions would guide you towards the solution.

    • The path of the user guide that Sriram mentioned is correct. Please refer the guidelines mentioned in that page for programming. It is unfortunate that directions to perform certain system and platform specific configurations are not mentioned in the programming sequence discussed in this page. I will escalate this issue and will get it corrected.
    • To start using GPIO or any peripheral in general, certain system configurations like programming the Power and Sleep Controller (PSC) has to be performed. Further, platform specific configurations like pin multiplexing has to be performed to ensure that the desired pin is available for use. You could refer to an example application present in the StarterWare package in the following path - "examples/evmOMAPL138/gpio/gpioCardDetect.c". This application detects the insertion and ejection of an MMC/SD card and demonstrates appropriate programming sequence.

    To give you an initial push in the above direction, I have referred to the Technical Reference Manual (TRM) of OMAPL138 and have made these observations.

    • GP0[8] : The relevant bits for Pin Multiplexing are PINMUX0_31_28 bits in PINMUX0 register. Value to be programmed is 0x8.
    • GP7[12] : The relevant bits for Pin Multiplexing are PINMUX16_23_20 bits in PINMUX16 register. Value to be programmed is 0x8.
    • Further, the pin serial number of GP7[12] is 125 and not 126.

    You could refer to the System Configuration (SYSCFG) module of the OMAPL138 TRM for more details.

    I hope these guidelines would help. Please revert back for any queries.

    Thanks and Regards.

    Gurudutt.

  • Hi Gurudutt and Sriram,

    Thank you for your answers, it helped me to understand how the GPIO work.

    Now I'm able to control the pin 8 of bank 0 now :)