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.

CCS/TMS320F28027F: PULL UP and PULL DOWN RESISTOR

Part Number: TMS320F28027F
Other Parts Discussed in Thread: C2000WARE, TMDSCNCD28027, TMS320F28027

Tool/software: Code Composer Studio

Hello Everyone,

I have written the following code in which my objective is to understand the INTERNAL PULL UP Resistor.The question is When I am  using GPIO(12-31) as a input  then whether I disable or enable the GPAPUD the GPIO is always behaving like a pull down i.e. '0' on output  which is i think opposite to what datasheet suggest ,Can anybody please help to find out and understand the problem? 

#include "DSP28x_Project.h"


void GPIO_SELECT(void);
void EPWM1_Example1(void);
void Gpio_Toggle(void);

int main(void)
{
   int a;

   InitSysCtrl();

   GPIO_SELECT();

   for(;;) {
     a = GpioDataRegs.GPADAT.bit.GPIO12;
     if(a == 1)
        EPWM1_Example1();
     else
        Gpio_Toggle();
    }
   return 0;

}

void GPIO_SELECT(void)
{
    EALLOW;
    GpioCtrlRegs.GPAPUD.bit.GPIO0 =1;
    GpioCtrlRegs.GPAPUD.bit.GPIO1 =1;
    GpioCtrlRegs.GPAPUD.bit.GPIO12 =0;


    GpioCtrlRegs.GPAMUX1.bit.GPIO0=1;
    GpioCtrlRegs.GPAMUX1.bit.GPIO1=1;

    GpioCtrlRegs.GPAMUX1.bit.GPIO2=0;
    GpioCtrlRegs.GPAMUX1.bit.GPIO12=0;

    GpioCtrlRegs.GPADIR.bit.GPIO2=1;
    GpioCtrlRegs.GPADIR.bit.GPIO12=0;

    EDIS;
}


void EPWM1_Example1(void) {
  
    GpioDataRegs.GPACLEAR.bit.GPIO2=1;
   
};

void Gpio_Toggle() {
  GpioDataRegs.GPASET.bit.GPIO2=1;
};


THANKS in Advance

 

  • Do you have anything connected to the pin? The pull up is weak and can be overpowered.

    Read back the configuration values using the memory browser to ensure that you have written the correct values. Are the configurations correct?

    Regards,
    Cody

     

  • Hey Cody,

    Thanks for the Reply....

    I have not connected anything to the pin at Gpio.

    Rather very strangle behavior I am observing ,I have written a very simple and easy just to observe the pull up and pull down behavior ,the code of which is below,the thing is that whenever i am enabling the pull-up of the gpio the GPADIR register start behaving in just opposite manner i.e GPACLEAR in enabling the the led and vice versa, and also can you help in that what should I do if i want my selected gpio should all behave in a pull down state.

    Thanks in advance.

    #include "DSP28x_Project.h"
    
    #define EPWM1_TIMER_TBPRD  1500
    
    void GPIO_SELECT(void);
    void EPWM1_Example1(void);
    void Gpio_Toggle(void);
    void delay_loop(void);
    int a;
    
    int main(void)
    {
    
       #ifdef _FLASH
         memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
        #endif
    
       InitSysCtrl();
    
       GPIO_SELECT();
    
       for(;;) {
    
         a = GpioDataRegs.GPADAT.bit.GPIO6;
    
         if(a == 1)
            EPWM1_Example1();
         else
            Gpio_Toggle();
        }
    
    }
    
    void GPIO_SELECT(void)
    {
        EALLOW;
    
        GpioCtrlRegs.GPAPUD.bit.GPIO2 = 0;
        GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO2 = 1;
    
        GpioCtrlRegs.GPAPUD.bit.GPIO6 = 0;
        GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO6 = 0;
    
        EDIS;
    }
    
    
    void GPIO_TOGGLE1 (void) {
        GpioDataRegs.GPACLEAR.bit.GPIO2=1;
    };
    
     void Gpio_Toggle() {
         GpioDataRegs.GPASET.bit.GPIO2=1;
    };
    
    
  • Rahul,

    what hardware are you using? Please note that the LEDs on both the F28027 LaunchPad and controlCARD are setup to be active low. This is because they sync current with a non-inverting buffer.

    Please if you are using one of these kits please see the schematics found in C2000Ware. 

    C:\ti\c2000\C2000Ware_2_00_00_02\boards\LaunchPads\LAUNCHXL_F28027

    C:\ti\c2000\C2000Ware_2_00_00_02\boards\controlCARDs\TMDSCNCD28027

    Regards,
    Cody 

  • Hey Cody,

    I am using a C2000 Launch PAD XL TMS320F28027 ,As you said the LED are setup for active low then the behavior of my code mentioned before if a predictable one but , the thing is if i use the the control suite GpioToggle code which is also mentioned below then this behave toatally opposite of the active low condition i.e the LED glows(turns on) when a GPIOSET command is made high and turns off when GPIOCLEAR is made high. Can You ,Please help know what is the actual difference or is there some problem is the code .

    Thanks in Advance.

    //###########################################################################
    //
    // FILE:    Example_2802xGpioToggle.c
    //
    // TITLE:   f2802x Device GPIO toggle test program.
    //
    // ASSUMPTIONS:
    //
    //    This program requires the f2802x header files.
    //
    //    ALL OF THE I/O'S TOGGLE IN THIS PROGRAM.  MAKE SURE
    //    THIS WILL NOT DAMAGE YOUR HARDWARE BEFORE RUNNING THIS
    //    EXAMPLE.
    //
    //    Monitor desired pins on an oscilloscope.
    //
    //    As supplied, this project is configured for "boot to SARAM"
    //    operation.  The 2802x Boot Mode table is shown below.
    //    For information on configuring the boot mode of an eZdsp,
    //    please refer to the documentation included with the eZdsp,
    //
    //    $Boot_Table
    //    While an emulator is connected to your device, the TRSTn pin = 1,
    //    which sets the device into EMU_BOOT boot mode. In this mode, the
    //    peripheral boot modes are as follows:
    //
    //      Boot Mode:   EMU_KEY        EMU_BMODE
    //                   (0xD00)	     (0xD01)
    //      ---------------------------------------
    //      Wait		 !=0x55AA        X
    //      I/O		     0x55AA	         0x0000
    //      SCI		     0x55AA	         0x0001
    //      Wait 	     0x55AA	         0x0002
    //      Get_Mode	 0x55AA	         0x0003
    //      SPI		     0x55AA	         0x0004
    //      I2C		     0x55AA	         0x0005
    //      OTP		     0x55AA	         0x0006
    //      Wait		 0x55AA	         0x0007
    //      Wait		 0x55AA	         0x0008
    //      SARAM		 0x55AA	         0x000A	  <-- "Boot to SARAM"
    //      Flash		 0x55AA	         0x000B
    //	    Wait		 0x55AA          Other
    //
    //   Write EMU_KEY to 0xD00 and EMU_BMODE to 0xD01 via the debugger
    //   according to the Boot Mode Table above. Build/Load project,
    //   Reset the device, and Run example
    //
    //   $End_Boot_Table
    //
    //
    // DESCRIPTION:
    //
    //     Three different examples are included. Select the example
    //     (data, set/clear or toggle) to execute before compiling using
    //     the #define statements found at the top of the code.
    //
    //
    //     Toggle all of the GPIO PORT pins
    //
    //    The pins can be observed using Oscilloscope.
    //
    //
    //###########################################################################
    // $TI Release: F2802x Support Library v230 $
    // $Release Date: Fri May  8 07:43:05 CDT 2015 $
    // $Copyright: Copyright (C) 2008-2015 Texas Instruments Incorporated -
    //             http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    
    #include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
    
    // Select the example to compile in.  Only one example should be set as 1
    // the rest should be set as 0.
      // Use TOGGLE registers to toggle I/O's
    
    // Prototype statements for functions found within this file.
    void delay_loop(void);
    void Gpio_select(void);
    void Gpio_example1(void);
    void Gpio_example2(void);
    void Gpio_example3(void);
    
    void main(void)
    {
    
       #ifdef _FLASH
    	memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
       #endif
    
    
       InitSysCtrl();
    
    
     // InitGpio(); 
     
       Gpio_select();
    
       DINT;
    
      Gpio_example1();
    }
    
    void delay_loop()
    {
        long int  i;
        for (i = 0; i < 100000; i++) {}
    }
    
    
    void Gpio_example1(void)
    {
       
       for(;;)
       {
    
           GpioDataRegs.GPASET.bit.GPIO0   = 1;
           GpioDataRegs.GPACLEAR.bit.GPIO1 = 1;
    
           delay_loop();
    
           GpioDataRegs.GPACLEAR.bit.GPIO0    = 1;
           GpioDataRegs.GPASET.bit.GPIO1      = 1;
    
           delay_loop();
        }
    }
    
    
    void Gpio_select(void)
    {
        EALLOW;
    	GpioCtrlRegs.GPAMUX1.all = 0x00000000;  // All GPIO
    	GpioCtrlRegs.GPAMUX2.all = 0x00000000;  // All GPIO
    	GpioCtrlRegs.GPAMUX1.all = 0x00000000;  // All GPIO
        GpioCtrlRegs.GPADIR.all = 0xFFFFFFFF;   // All outputs
        GpioCtrlRegs.GPBDIR.all = 0x0000000F;   // All outputs
        EDIS;
    }
    
    
    

       

  • Are you using the GPIO as an input or an output? It appears that you have changed what you were trying to do in earlier posts.

    Try placing a break point on line 119 and observing the output. Do the same on line 124.

    Regards,
    Cody 

  • This thread will be closing soon, Please respond if this problem has not been resolved.

    Regards,
    Cody