Beaglebone default GPIO values

Hi all,
I have an issue (my fault probably) where i would like to define default states of GPIO ports. I have created my own cape based on univ-all where i define two port’s as follows:

P8_03_default_pin: pinmux_P8_03_default_pin {
pinctrl-single,pins = <0x018 0x27>; };
P8_03_gpio_pin: pinmux_P8_03_gpio_pin {
pinctrl-single,pins = <0x018 0x27>; };

P8_04_default_pin: pinmux_P8_04_default_pin {
pinctrl-single,pins = <0x01c 0x17>; };
P8_04_gpio_pin: pinmux_P8_04_gpio_pin {
pinctrl-single,pins = <0x01c 0x17>; };

0x27 should read as: mode 7, input, pulldown
0x17 should read as: mode 7, output, pullup.

My goal is to have port P8_03 loaded as input with LOW state (0V) by default (so cat gpio38/value would show 0), and port P9_04 as output with HIGH state (3,3V) by default (so cat gpio39/value would show 1).

Most of those things are working ok, so direction are correct (by default), however P8_03 is 1 by default (should be 0), and P8_04 is 0 (should be 1).

What am i doing wrong here?

Thats how i wanted to make them by default.

I think you need to read the System Reference Manual a few more times.

P8 Pins 3 through 6, and Pins 20 through 25 are used by the eMMC, so if you reassign those pins, you will only be able to boot/run from uSD card, eMMC will no longer work.

P8 Pins 31 through 46 are “Boot Pins.” If you try to use those pins, and do not add some circuitry so that they are not isolated during boot process, the BBB will no longer boot.

P8 Pins 27 through 46 are used if there is an LCD display, so if you use these pins, it will not be possible to also use an LCD display. You may or may not care about this.

— Graham

Hi Łukasz!

Hi all,
I have an issue (my fault probably) where i would like to define default states of GPIO ports. I have created my own cape based on univ-all where i define two port’s as follows:

P8_03_default_pin: pinmux_P8_03_default_pin {
pinctrl-single,pins = <0x018 0x27>; };
P8_03_gpio_pin: pinmux_P8_03_gpio_pin {
pinctrl-single,pins = <0x018 0x27>; };

P8_04_default_pin: pinmux_P8_04_default_pin {
pinctrl-single,pins = <0x01c 0x17>; };
P8_04_gpio_pin: pinmux_P8_04_gpio_pin {
pinctrl-single,pins = <0x01c 0x17>; };

This looks like a device tree (overlay) fragment. You can set the pin muxing by loading an device tree (overlay), but you cannot set the state of an output pin that way. Therefor you have to export the pin and set its state accordingly.

BTW: The configurations are equal (for P8_03 as well as for P8_04). Why do you declare them twice?

0x27 should read as: mode 7, input, pulldown
0x17 should read as: mode 7, output, pullup.

My goal is to have port P8_03 loaded as input with LOW state (0V) by default (so cat gpio38/value would show 0), and port P9_04 as output with HIGH state (3,3V) by default (so cat gpio39/value would show 1).

As you stated, P8_03 is configured as an input pin. You cannot load an input at any state. Its value depends on the connected hardware. If voltage at this pin is above 1V6 you’ll see high state. Voltages below 0V8 result in low state, inbetween it’s undefined.

Regards