Can a GPIO Pin (HAT) change from input to output (or reverse) in Linux (Ubuntu)?

Options

I have 2 Up2 boards (one with BIOS UPA1AM21, another with BIOS UPA1AM50), I try to change a GPIO pin from input to output (or reverse), but none of the pins on HAT can do this. These pins are redefined as either input or output only. So can a GPIO Pin (HAT) change from input to output (or reverse) in Linux (Ubuntu)?

For example:
Config HAT pin 29 (linux pin 430) on BIOS setting
(1) I first try ACPI mode
LPSS SPI #1 Support [ACPI Mode]
LPSS SPI #3 Support [ACPI Mode]
GPIO 11 (PIN29) Confi LPSS SPI #3

(2) also, try to disable ACPI mode
LPSS SPI #1 Support [Disabled]
GPIO 11 (PIN29) Confi [Input]

On linux
(init pin as default state: input)
$ echo 430 > /sys/class/gpio/export
(1) pin is an input/high impedance, but (2) pin is an output/high

then I change the pin to output
$ echo out > /sys/class/gpio/gpio430/direction
(1) pin keep as an input, (2) pin is an output, but now pull low

then I change the state of the output
$ echo 1 > /sys/class/gpio/gpio430/value
(1) pin keep as an input, (2) pin is an output, now pull high as expected

The above is a simple example showing that a GPIO stage seems to be redefined at the BIOS setting. Is there something wrong with my board, or it's just that the GPIO can not do it because of the current FPGA config?

Thank you!

Answers

This discussion has been closed.
Privacy Policy