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.

PxREN : need explanations

Other Parts Discussed in Thread: MSP430F2274

Dear MSP430-Masters,

I need some help to clearly understand MSP430's datasheet and userguide about PxREN registers.

Well, starting from the beginning, from the userguide, writing 1 to PxREN.y enables the pullup/pulldown resistor of PORTx.y

Considering the datasheet, and to be more precise the logic diagram of PORTx, if I setup PORTx as OUTPUTS, and PxREN disabled, I have the feeling that pins are always floating, because it is not possible to separately enable the pullup and the pulldown.  Am I right ? Did I missunderstood something ?

I'm asking this, because I would like to setup a pin with pull-down enabled, and pull-up disabled. I mean, when I write PORTx.y = 0, PORTx.y is tied to Vss, and when I write PORTx.y = 1, PORTx.y is floating.

Another question : What is the initial state of PxREN ? Userguide says "Reset after PUC" .. what does this mean ? 0xFF or 0x00 ?

Thanks for your help.

  • Hi,

    pls find an example for a MSP430F2274 I/O below:

    P1SEL &= ~BIT2;                         // i/o function selected, 0

    P1DIR &= ~BIT2;                         // input mode (P1.2), 0

    P1OUT |= BIT2;                           // select pull-up mode

    P1REN |= BIT2;                           // enable internal pull up, 1

    Now, when you have a look at the users manual (http://focus.ti.com/lit/ug/slau144e/slau144e.pdf) - chapter 8 - you will find the details:

    PxSEL --> configure the function of the I/O

    PxDIR --> selects INPUT or OUTPUT mode

    PxOUT --> If the pin’s pull−up/down resistor is enabled, the corresponding bit in the PxOUT register selects pull-up or pull-down.
    Bit = 0: The pin is pulled down 
    Bit = 1: The pin is pulled up

    PxREN --> Each bit in each PxREN register enables or disables the pullup/pulldown resistor of the corresponding I/O pin. The corresponding bit in the PxOUT register selects if the pin is pulled up or pulled down.
    Bit = 0: Pullup/pulldown resistor disabled 
    Bit = 1: Pullup/pulldown resistor enabled

    Now, have a look at the MSP430 device data sheet (MSP430F2274 in my example, http://focus.ti.com/lit/ds/symlink/msp430f2274.pdf, page 57): P1.2/TA1 --> I/O selcted = P1.2 (P1SEL.BIT2 = 0), P1.2 is in input mode (P1DIR.BIT2 = 0), Pull-Ups were disabled (P1OUT.BIT2 and P1REN.BIT2 = 0).

    Rgds
    aBUGSworstnightmare 

     

  • Thanks aBUGSworstnightmare,

    So, if I well understood what you said, it is not possible to setup a pin in order to have the following behaviour :

    - P1OUT &= ~BIT2;  // ties P1OUT.2 to Vss

    - P1OUT |= BIT2;  // P1OUT.2 is floating

    Am I wrong ?

     

    Then, what is the real usage of PxREN ? Only for inputs ?

  • Hi VDM,

    what do you expect from the I/O-pin, means what do you intend do do?

    Usually, internal pull-ups were used when you have pins configured as inputs. If you need pins which were outputs and then you will change them to a high-impedance state (for whatever reason) you should have a look at http://focus.ti.com/lit/an/slaa309/slaa309.pdf. This aplication note has some nice code on how to drive 6 LEDs (only one is on at a time) with only 3 I/Os.

    Rgds
    aBUGSworstnightmare

  • Hi,

    What I want, is to setup an I/O as an open-drain output.

    I'll have a look the appnote, thanks.

  • When a digital I/O pin is set up with DIR=0 and OUT=0, the impedance is high. But if you switch to DIR=1 (with OUT=0), that pin will be driven low. Thus you can use DIR to control between high-impedance and driven-low. This is similar to an open-drain output pin.

  • Quick question.

    when a pin is set to high impedance in what range we expect to read ohms out of that pin?

    Rhonal Soto

  • When the pin is high-impedance, then what you will see is the input leakage current (which is specified in the device datasheet, I don't recall if you mentioned your specific device) since the digital input module is always active (even when pin is an output).

    Usually in "open-drain" mode, you use an external pull-up resistor on the pin, keep a "0" in the output register bit, and toggle between input and output to make it a "Z" or "0" value on the pin.

    You can measure the input leakage by measuring the voltage across your external pullup and calculating the current through it. Be advised though that this will vary from part to part (process variation) as well as over temperature (and to a lesser extent Vcc voltage).

  • VDM said:
    if I setup PORTx as OUTPUTS, and PxREN disabled, I have the feeling that pins are always floating, because it is not possible to separately enable the pullup and the pulldown.  Am I right ? Did I missunderstood something ?

    If you set up the port as output (PxDIR.y=1), then the port output driver is actively pulling the output either up or down, depending on the content of PxOUT.y. This will override any effect of the pullups, and because of this, the pullups are disabled in most MSPs when the port is in output direction.

    VDM said:
    I would like to setup a pin with pull-down enabled, and pull-up disabled.

    In this case, the port must be in input direction (PxDIR.y=0), the pullup must be set to pulldown mode (PxOUT.y=0) and you enable the pulldown with PxREN.y=1 and turn it back to floating (high-impedance input) with PxREN.y=0;

    VDM said:
    Userguide says "Reset after PUC" .. what does this mean ?

    reset = clear = 0, in opposition to set = 1.
    A look at the register description (last section of any users guide chapter) also tells you the initial bit values in the 'register bits table' above the bit descriptions.

**Attention** This is a public forum