Cannot use DAP2_FS as gpio

I am trying to get two pins to operate as GPIO on the TX2 NX. I’ve configured them in the NX system pinmux spreadsheet, and am using the following configurations for those pins, which was generated from the spreadsheet:

                    dap2_fs_pc4 {
                            nvidia,pins = "dap2_fs_pc4";
                            nvidia,function = "rsvd1";
                            nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                            nvidia,tristate = <TEGRA_PIN_ENABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                            nvidia,lpdr = <TEGRA_PIN_DISABLE>;
                    };

                    gen7_i2c_scl_pl0 {
                            nvidia,pins = "gen7_i2c_scl_pl0";
                            nvidia,function = "rsvd2";
                            nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                            nvidia,tristate = <TEGRA_PIN_ENABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                            nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
                            nvidia,lpdr = <TEGRA_PIN_DISABLE>;
                    };

I believe these should map to GPIO numbers 340 and 408, respectively. When I do

$ echo 408 >/sys/class/gpio/export

it (as expected) creates the proper gpio408 directory and the symlink to it in /sys/class/gpio.

However,

$ echo 340 >/sys/class/gpio/export

Gives an error:

echo: write error: Device or resource busy

Can anybody offer guidance, how to determine what is keeping that particular pin “busy” so that it can’t be exposed as a GPIO?

Thanks for any suggestions.

hello dpengel3,

it’s due to this pin is occupied by system. please check pinmux spreadsheets for the default pin usage,
this pin, GPIO06 / GPIO3_PC.04 is by default as baseboard CAM I2C Mux select.

According to the pinmux spreadsheet for the NX (which I’m using), the default usage for this pin is I2S2_LRCK. I used the spreadsheet to change the customer usage to GPIO3_PC.04 and generate the pinmux settings for that pin. Those are the same settings I reported in my post.

Is there something else I’m missing?

hello dpengel3,

please check the device tree, for example, there’s IMX219 to use this pin, #define CAM_I2C_MUX TEGRA_MAIN_GPIO(C, 4)
IMX219 is the reference camera module, you should remove that, or, exclude that dtsi sources if you’re going to use GPIO3_PC.04 for your own use-case.
thanks

Thanks for the tip. That was the issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.