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.

CC2650 : GPIO tristate settings

Other Parts Discussed in Thread: CC2650

currently working on CC2650, i have few questions regarding GPIO.

1.what is is default state of GPIO?

2.How i can make particular gpio pin to tri-state ? or GPIO setting.

3.is correct ? connecting a resistor(10 to 100k) accross the gpio to check the tri-state of the gpio.

Thanks and advance,
Jayachandran R

  • Hello. I would recommend looking at the PIN driver documentation at file:///C:/ti/tirtos_simplelink_2_11_01_09/docs/doxygen/html/index.html.

    There is also a PIN section of the Software Developer's Guide (http://www.ti.com/lit/pdf/swru393)

    The startup pin levels are set in the first line of main:

    Void main()
    {
      PIN_init(BoardGpioInitTable);

    The table referenced here is defined in the board file (board.c)

  • Tim,

    i have checked the documentation explained in PIN.h, from the explanation i can see like:

    - I/O buffer/driver control
    * - Input mode (detached, hysteresis, pull-up, pull-down)
    * - Output mode (tristated, push-pull, open drain, open source)
    * - Output driver strength control
    * - Output driver slew rate control

    in above explanation, tri-state is only available in output mode, but when we see the output modes macros defined, we don't find any thing related to tri state configuration. the output modes provided in documentation looks like:

    ### Output Mode Options ###
    * | Option | Option bitmask | HW/GPIO | Description |
    * |------------------------|------------------------|---------|----------------------------------|
    * |#PIN_GPIO_OUTPUT_DIS (*) |#PIN_BM_GPIO_OUTPUT_EN | GPIO | Disable GPIO output buffer |
    * |#PIN_GPIO_OUTPUT_EN |#PIN_BM_GPIO_OUTPUT_EN | GPIO | Enable GPIO output buffer |
    * |#PIN_GPIO_LOW (*) |#PIN_BM_GPIO_OUTPUT_VAL | GPIO | Output 0 when GPIO |
    * |#PIN_GPIO_HIGH |#PIN_BM_GPIO_OUTPUT_VAL | GPIO | Output 1 when GPIO |
    * |#PIN_PUSHPULL (*) |#PIN_BM_OUTPUT_BUF | Both | Use push-pull output buffer |
    * |#PIN_OPENDRAIN |#PIN_BM_OUTPUT_BUF | Both | Use open drain output buffer |
    * |#PIN_OPENSOURCE |#PIN_BM_OUTPUT_BUF | Both | Use open source output buffer |
    * |#PIN_SLEWCTRL |#PIN_BM_SLEWCTRL | Both | Enable output buffer slew control|
    * |#PIN_DRVSTR_MIN (*) |#PIN_BM_DRVSTR | Both | Output buffer uses min drive |
    * |#PIN_DRVSTR_MED |#PIN_BM_DRVSTR | Both | Output buffer uses medium drive |
    * |#PIN_DRVSTR_MAX |#PIN_BM_DRVSTR | Both | Output buffer uses max drive |
    * | |#PIN_BM_OUTPUT_MODE | | Mask for all output mode options |


    so here we dont find anything like tristate configuration. can you please explain how can we configure the GPIO pin in to tristate using the PIN driver provided by TI.

    thanks.
  • Tim,

    i have checked the documentation explained in PIN.h, from the explanation i can see like:

    - I/O buffer/driver control
    * - Input mode (detached, hysteresis, pull-up, pull-down)
    * - Output mode (tristated, push-pull, open drain, open source)
    * - Output driver strength control
    * - Output driver slew rate control

    in above explanation, tri-state is only available in output mode, but when we see the output modes macros defined, we don't find any thing related to tri state configuration. the output modes provided in documentation looks like:

    ### Output Mode Options ###
    * | Option | Option bitmask | HW/GPIO | Description |
    * |------------------------|------------------------|---------|----------------------------------|
    * |#PIN_GPIO_OUTPUT_DIS (*) |#PIN_BM_GPIO_OUTPUT_EN | GPIO | Disable GPIO output buffer |
    * |#PIN_GPIO_OUTPUT_EN |#PIN_BM_GPIO_OUTPUT_EN | GPIO | Enable GPIO output buffer |
    * |#PIN_GPIO_LOW (*) |#PIN_BM_GPIO_OUTPUT_VAL | GPIO | Output 0 when GPIO |
    * |#PIN_GPIO_HIGH |#PIN_BM_GPIO_OUTPUT_VAL | GPIO | Output 1 when GPIO |
    * |#PIN_PUSHPULL (*) |#PIN_BM_OUTPUT_BUF | Both | Use push-pull output buffer |
    * |#PIN_OPENDRAIN |#PIN_BM_OUTPUT_BUF | Both | Use open drain output buffer |
    * |#PIN_OPENSOURCE |#PIN_BM_OUTPUT_BUF | Both | Use open source output buffer |
    * |#PIN_SLEWCTRL |#PIN_BM_SLEWCTRL | Both | Enable output buffer slew control|
    * |#PIN_DRVSTR_MIN (*) |#PIN_BM_DRVSTR | Both | Output buffer uses min drive |
    * |#PIN_DRVSTR_MED |#PIN_BM_DRVSTR | Both | Output buffer uses medium drive |
    * |#PIN_DRVSTR_MAX |#PIN_BM_DRVSTR | Both | Output buffer uses max drive |
    * | |#PIN_BM_OUTPUT_MODE | | Mask for all output mode options |


    so here we dont find anything like tristate configuration. can you please explain how can we configure the GPIO pin in to tristate using the PIN driver provided by TI.

    can you also please tell me what si the default state of pin after micro-controller reset if we do not configure the pin.

    thanks.
  • Tim,

    i have checked the documentation explained in PIN.h, from the explanation i can see like:

    - I/O buffer/driver control
    * - Input mode (detached, hysteresis, pull-up, pull-down)
    * - Output mode (tristated, push-pull, open drain, open source)
    * - Output driver strength control
    * - Output driver slew rate control

    in above explanation, tri-state is only available in output mode, but when we see the output modes macros defined, we don't find any thing related to tri state configuration. the output modes provided in documentation looks like:

    ### Output Mode Options ###
    * | Option | Option bitmask | HW/GPIO | Description |
    * |------------------------|------------------------|---------|----------------------------------|
    * |#PIN_GPIO_OUTPUT_DIS (*) |#PIN_BM_GPIO_OUTPUT_EN | GPIO | Disable GPIO output buffer |
    * |#PIN_GPIO_OUTPUT_EN |#PIN_BM_GPIO_OUTPUT_EN | GPIO | Enable GPIO output buffer |
    * |#PIN_GPIO_LOW (*) |#PIN_BM_GPIO_OUTPUT_VAL | GPIO | Output 0 when GPIO |
    * |#PIN_GPIO_HIGH |#PIN_BM_GPIO_OUTPUT_VAL | GPIO | Output 1 when GPIO |
    * |#PIN_PUSHPULL (*) |#PIN_BM_OUTPUT_BUF | Both | Use push-pull output buffer |
    * |#PIN_OPENDRAIN |#PIN_BM_OUTPUT_BUF | Both | Use open drain output buffer |
    * |#PIN_OPENSOURCE |#PIN_BM_OUTPUT_BUF | Both | Use open source output buffer |
    * |#PIN_SLEWCTRL |#PIN_BM_SLEWCTRL | Both | Enable output buffer slew control|
    * |#PIN_DRVSTR_MIN (*) |#PIN_BM_DRVSTR | Both | Output buffer uses min drive |
    * |#PIN_DRVSTR_MED |#PIN_BM_DRVSTR | Both | Output buffer uses medium drive |
    * |#PIN_DRVSTR_MAX |#PIN_BM_DRVSTR | Both | Output buffer uses max drive |
    * | |#PIN_BM_OUTPUT_MODE | | Mask for all output mode options |


    so here we dont find anything like tristate configuration. can you please explain how can we configure the GPIO pin in to tristate using the PIN driver provided by TI.

    can you also please tell me what is the default state of pin after micro-controller reset if we do not configure the pin.

    thanks.
  • After reset all pins are high impedance with both input and output buffer disabled.
    Disabling the output will effectively put the pin in what you call tri-state configuration.

    If nothing is driving the IO to a valid logical level when the output buffer is disabled you should have the input buffer disabled as well to avoid excessive current draw through the IO input buffer.

    .:svend
  • hi svend,

    As per the prvious comments, as startup configuration we have confgured a pin as GPIO and output disabled, but still we are not able to abserve any tri-state on the pin when we tried to probe it using oscilloscope,  instead it always being low.

    kindly help us to investigate more on this tri state configuration of GPIO pin

    thanks and regards,

    jayachandran R

  • Can you tell me how you plan to observe that a pin is tri-stated? Do you have an external pull level defined? If not then the pin will typically float to VDD or GND, connecting an oscilloscope (typically 1Mohm impedance) will most certainly make the charge on this pin leak out to GND.

    To check this the best thing you can do is to connect either VDD or GND to the pin through a multi meter measuring current to see that nothing is driving the pin to one of the supply rails.

    Regards,
    Svend
  • Hi Svend
    thanks for your reply.
    i have made a setup like connected a 51k series between the GPIO and VDD, we observed some voltage drop at GPIO (0.8v) and 2.5v drops across the 51K and leakage current at GPIO is around 40uA.

    thanks and regards,
    Jayachandran R
  • Hi,

    In that case I doubt you have turned off the output buffer. Can you provide the code you are using to do this?

    Regards,

    Svend

  • Hi Svend,

    You are right. the code snippet looks like this:

    PIN_Config BoardGpioInitTable[] = {

        Board_IO1       |  PIN_GPIO_OUTPUT_DIS,                    
         PIN_TERMINATE                                                                               /* Terminate list                */
    };

    this is what we got reply to disable the output to put the GPIO pin in tri state. so thats the reason we are using this configuration.

    Requirement is that the pin should be in tri-state after reset, that is the reason we have choosen the "PIN_Config BoardGpioInitTable[]" to configure the pin to GPIO as output tri state. can you please suggest the macros to be used to meet the requirement. we have a confusion here while using the pin driver to configure the pin as tri state as we dont see any thing related to tri state in PIN.h documentation( for readability purpose).

    please suggest the way to achieve the requirement.

    thanks.

  • This configuration looks correct. You need to add in PIN_GPIO_INPUT_DIS if you also want to disable the input buffer.
    When you first run PIN_init the IO's will be configured to this mode but a call to PIN_open using a different PIN_Config later might override this.

    Regards,
    Svend
  • Hi Svend,

    you were saying configuration looks correct but we are not able to find any tri state( other than 0v and 3.3v) after reset on pin when we try to probe it, instead it always being in low. so now if i try to connect the pin with resistor of 51k to 3.3v the voltage near pin should be 3.3v( if it is tri state), but we were not able to see 3.3v near pin instead some 0.8v is observed and leakage current of 49uA is observed. why this is happening if the configuration( tri state) is correct.

    Can you please provide configuration macros to be used to put the GPIO pin in to tri state ( both in output and input direction ). this will be great if we can understand the things using the pin driver provided.

    thanks.
  • Can you try the following:

    PIN_Config pinTable[] = {
      Board_IO1 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS,
      PIN_TERMINATE /* Terminate list */
    };

    int main(void) {
      PIN_init(pinTable);
      while(1); //<- pin is now tri stated
    }

  • Svend, we tried this but the result was same. after reset pin was low all the time, now if we try to connect the resistor to 3.3v as explained above we can see some leakage current current and with voltage drop near resistor.

    can you please tell me if we use above configuration what you have mentioned, whether the pin will be tri stated in output or input direction?

    i don't think this is satisfying to configure the pin in tri state. my point is like when we say pin is tri state the voltage on pin should be other than 0 or VDDS(supply voltage).

    thanks,
  • Svend, this seems to be a typical observation.

    tri state is not observed with the stack version 0.8, but with 2.0 the tri state is being observed. we have verified the between the two versions and 2.0 is working as expected.

    in a blind way, w have just commented the pin_init function in main, this means after reset if we don't configure the pin and the pins should be in tri state as per the user manual. so now we have connected the resistor to the pin with 3.3v and we were able to observe the total voltage near pin for 2.0 version but we were not able to find in 0.8 stack version(this is for your information, we are also not sure whether there is any issue in 0.8 stack divers library).

    thanks.
  • The code I posted works fine on TI RTOS 2.11.01.09 included with the 2.0 BLE stack as you also have seen.
    Alpha release v0.8 is quite old and not supported any more, there might be a number of bugs in that one that have been fixed in later releases.

    Regards,
    Svend