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.

AM3358: GPIO input with no internal pull-down

Part Number: AM3358

Hi,

I have GPIOs set up without internal pull-down. on u-boot:

static struct module_pin_mux my_gpio_pin_mux[]

{

{OFFSET(gpio3_9), MODE(7)},

{OFFSET(gpio3_9), MODE(7)},

{OFFSET(gpio3_9), MODE(7)},

{-1}

};

and in linux in device tree:

port3_gpios: port3_gpios {
pinctrl-single,pins = <
0x114 (PIN_INPUT | MUX_MODE7) /* gpio3[3] */
0x12c (PIN_INPUT | MUX_MODE7) /* gpio3[9] */
0x130 (PIN_INPUT | MUX_MODE7) /* gpio3[10] */
>;
};

I Don't have pull downs enabled, but if I connect 10k external pull-up to 3.3V to these pins, the voltage at the pin is 2.48V.

So by the voltage reading it looks like there is 30k pull down. 

Setting pins as PIN_INPUT_PULLDOWN | MUX_MODE7 give the same 2.48V reading.

Is internall pull-down always enabled or am I missing something to disable it?

Kind regards,

Ugnius

  • Hi Ugnius,

    From what I understand, you are checking the voltage (3.3V/2.48V) at user space, after linux boot up.

    Can you verify you have the correct value in conf_mii1_tx_en/0x44E10914 register? Please provide the value you have there just before measuring the voltage.

    You can explore that value with devmem2 tool or omapconf tool in user space.

    Regards,
    Pavel
  • Hi Pavel,

    Running the devmem2 tool gave this:

    Read at address  0x44E10914 (0xb6f31914): 0x00000007

    Looking at the register description bit 3 is controlling pull-up/pull-down.

    Pad pullup/pulldown enable
    0: Pullup/pulldown enabled
    1: Pullup/pulldown disabled
    Reset value is pad-dependent.

    It looks like pull-down is enabled after all.

    Is the value of this register set-up in device tree or u-boot pinmux?

    Kind regards,

    Ugnius

  • Ok I managed to solve the problem now. Thanks for referring me to the conf_mii1_tx_en/0x44E10914 register

    Looking at the uboot mask defines:

    #define PULLDOWN_EN (0x0 << 4) /* Pull Down Selection */
    #define PULLUP_EN (0x1 << 4) /* Pull Up Selection */
    #define PULLUDEN (0x0 << 3) /* Pull up enabled */
    #define PULLUDDIS (0x1 << 3) /* Pull up disabled */

    and the register description:

    Bit 4:
    Pad pullup/pulldown type selection
    0: Pulldown selected
    1: Pullup selected
    Reset value is pad-dependent.

    Bit 3:
    Pad pullup/pulldown enable
    0: Pullup/pulldown enabled
    1: Pullup/pulldown disabled
    Reset value is pad-dependent.

    I should set up my GPIOs:

    static struct module_pin_mux my_gpio_pin_mux[]

    {

    {OFFSET(gpio3_9), MODE(7) | PULLUDDIS},

    {OFFSET(gpio3_9), MODE(7) | PULLUDDIS},

    {OFFSET(gpio3_9), MODE(7) | PULLUDDIS},

    {-1}

    };

    This now works and my Pin voltage sits at 3.3V when external pull-up is connected.

    The confusing bit was PULLUDEN and PULLUDDIS description which says Pull up enabled or Pull up disabled.
    When looking to datasheet it is actually pull-up/pull-down enable/disable.

    I have one more question regarding this.
    When I set up conf_mii1_tx_en/0x44E10914 register in uboot, does linux device tree entry modify it at all?
    Or is it ignored and u-boot set-up is one that is required?

    Kind regards,
    Ugnius
  • Ugnius Subacius said:
    I have one more question regarding this.
    When I set up conf_mii1_tx_en/0x44E10914 register in uboot, does linux device tree entry modify it at all?
    Or is it ignored and u-boot set-up is one that is required?

    Yes, seems that linux kernel modify that register also, setting it in MUX_MODE2.

    linux-4.9.59/arch/arm/boot/dts/am335x-evm.dts

    cpsw_default: cpsw_default {
            pinctrl-single,pins = <
                /* Slave 1 */
                AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_tctl */

    Regards,
    Pavel

  • Ok so using AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */ sets up the gpio pad options.
    Directly writing to register 0x914.
    So in my case I should have
    AM33XX_IOPAD(0x914, PIN_INPUT | MUX_MODE7) /* mii1_txen.rgmii1_tctl as GPIO */

    Does it work differently from

    port3_gpios: port3_gpios {
    pinctrl-single,pins = <
    0x114 (PIN_INPUT | MUX_MODE7) /* gpio3[3] */
    >;
    };

    Because using the later did not disable the pull down even though in the DT_bindings defines

    #define PULL_DISABLE (1 << 3)
    #define INPUT_EN (1 << 5)
    #define PIN_INPUT (INPUT_EN | PULL_DISABLE)
  • Ugnius Subacius said:
    Ok so using AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */ sets up the gpio pad options.
    Directly writing to register 0x914.
    So in my case I should have
    AM33XX_IOPAD(0x914, PIN_INPUT | MUX_MODE7) /* mii1_txen.rgmii1_tctl as GPIO */

    Yes

    Ugnius Subacius said:
    Does it work differently from

    port3_gpios: port3_gpios {
    pinctrl-single,pins = <
    0x114 (PIN_INPUT | MUX_MODE7) /* gpio3[3] */
    >;
    };

    No, it is the same.

    Ugnius Subacius said:
    Because using the later did not disable the pull down even though in the DT_bindings defines

    How exactly you verify that? Do you check conf_mii1_tx_en/0x44E1_0914 register in u-boot prompt with md command?

    Regards,
    Pavel

  • I had my pinmux in uboot set up to enable pull-down.

    and my kernel device tree entry to set that pin as input, which should disable pull-down and overwrite u-boot set-up.

    port3_gpios: port3_gpios {
    pinctrl-single,pins = <
    0x114 (PIN_INPUT | MUX_MODE7) /* gpio3[3] */
    >;
    };

    in linux, running the tool you suggested showed that u-boot settings were in place and not the DT.
    Even though the sequence is uboot -> DT
  • Ugnius Subacius said:
    and my kernel device tree entry to set that pin as input, which should disable pull-down and overwrite u-boot set-up.

    port3_gpios: port3_gpios {
    pinctrl-single,pins = <
    0x114 (PIN_INPUT | MUX_MODE7) /* gpio3[3] */
    >;
    };

    This format is valid only for u-boot, not for linux. For linux use the below format:

    AM33XX_IOPAD(0x914, PIN_INPUT | MUX_MODE7)