Is it possible to configure a GPIO for both input and output in the Device Tree Overlay

535 views
Skip to first unread message

halh...@gmail.com

unread,
Apr 12, 2014, 11:31:05 AM4/12/14
to beagl...@googlegroups.com
Hello all,
I was wondering if it's possible to configure a GPIO pin on the Beaglebone black as a bidirectional GPIO via device tree overlays. Essentially allowing the developer to control the pins direction via the /sys/class/gpio/gpioxx/direction file in sysfs.

A close look at the pinmux table/registers in the TRM reveals that setting bit 5 enables the receiver (input) and clearing bit 5 disables the receiver (input). If I enable the receiver can I use the GPIO pin as both input and output or would it have to be input only ?

And if that isn't possible is there any other way to use the GPIO pins bidirectionally without having to dynamically load device tree overlays every time we need to change the direction of a GPIO ?

 
Thanks! 
Hussam

bris...@yahoo.com.au

unread,
Apr 12, 2014, 7:17:59 PM4/12/14
to beagl...@googlegroups.com
Bit 5 in the control module register controls whether the pin can be used as a input as well as an output.
Its the GPIO_OE register that controls whether it is configured as an input or an output.

Hussam Hertani

unread,
Apr 12, 2014, 8:57:44 PM4/12/14
to beagl...@googlegroups.com
thanks for the reply briselec! so setting bit 5 enables the pin to be both an output pin and an input pin. The pins themselves could obviously only be either an input or output pin at any one time depending on the value in the GPIO_OE reg.

And the sysfs interface likely sets/clears the GPIO_OE register depending on what value ("out" or "in") is written in the GPIO's 'direction' file.

Does this sound about right ?

For generic GPIO, does that mean that writing a value of 0x2F in the GPIO's control module register via device tree overlays will enable the GPIO as a bidirectional pin? Are there any recommendations for the pull-up/down settings for bi-directional I/Os? I know that they come in handy for inputs configurations, not sure about the bidirectional/output configurations though.

0x2F => 0010 1111

bits 0-2 (111) Mode 7
bit 3      (1)     Pull up/down Disabled
bit 4       (x)    Pull up/down type (bit 3 is disabled hence this doesn't matter)
bit 5      (1)     Receiver enabled
bit 6      (0)     Fast slew rate

Thanks!
Hussam


On Sat, Apr 12, 2014 at 7:17 PM, <bris...@yahoo.com.au> wrote:
Bit 5 in the control module register controls whether the pin can be used as a input as well as an output.
Its the GPIO_OE register that controls whether it is configured as an input or an output.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/l7y23bwkzTE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages