How to use gpio for TX2?

Hello.
I am testing a gpio on a TX2 board.
I use an oscilloscope to check the waveform.

Change the value by using the following command.
command example: echo 1 > /sys/class/gpio/gpio297/value
The pin number of gpio297 is J21-32.

However, when I type this command, I get the following error.
-su: echo: write error: Operation not permitted

What can I do?

I can’t tell you what the specific GPIO number is which maps where, but if you see “permission denied” while using with sudo, then very likely the GPIO is already in use by something else. However, if you check the content of “/sys/kernel/debug/gpio”, then it should provide a listing of current use.

If the GPIO was not exported, then the file itself would not have shown up to perform the echo to.