Xavier NX external SD card hot plug in/out on custom board (JetPack 4.6)

Hello,

I’m facing very similar problem to one in thread:

But since I did not found a proper solution in there, I’ll try to create a new one.
A short description of what I have and don’t:

  1. A SoM without SDCARD but with EMMC
  2. JetPack 4.6
  3. External SDCARD - working, but without hot plug in/out
  4. SD_DECTECT line in our design connected to pin 208 and with scope I managed to see line changes during physical SDCARD insertion / removal.
  5. DTB changes
    File: hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-p3668-common.dtsi

    sdhci_sd: sdhci@3400000 {
    mmc-ocr-mask = <0x0>;
    cd-inverted;
    //cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(G, 7) 0>; // original line
    cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>;
    nvidia,cd-wakeup-capable;
    mmc-ocr-mask = <0>;
    cd-inverted;
    vmmc-supply = <&p3668_vdd_sdmmc1_sw>;
    status = “okay”;
    };

cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>; <–In this line I used the following :
According to file: Jetson_Xavier_NX_Pinmux_Configuration_Template_v1
Line 187, the GPIO08 connected to pin #208 and GPIO name is GPIO3_PQ.02.

I also tried to manipulate with following in DTB
cd-gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(Q, 2) 0>;
or
cd-gpios = <&tegra_aon_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>;
None of them worked :-(

Additional DTB changed was:
hardware/nvidia/oc/t19x/kernel-dts/tegra194-soc/tegra194-soc-sdhci.dts
sdmmc3: sdhci@3440000 {
compatible = “nvidia,tegra194-sdhci”;

//status = “disabled”; //closed original line
status = “okay”;
}

Any help will be appreciated

Please search “sdmmc3” keywords over jetson NX forum and see how I debug such issue with other users.

Hey,

As I mentioned at the beginning of the thread, I did found the thread with [JerryChang], but there was no solution

Hi,

Yes, I know, so you can also check the thread answered by me first.

https://forums.developer.nvidia.com/search?q=sdmmc3%20%23jetson-embedded-systems:jetson-xavier-nx

If you still not able to debug your problem after checking those topics, please share your dmesg and board schematic.

Sorry that these questions are too common over the forum so I think you can study them first.

dmesg.txt (68.1 KB)


I’m attaching the dmesg and schematics.
The other threads are not helped me. I did found only 1 suitable thread and there was no solution in it (sorry for repeating )

Ahh… Have you checked the what you just said in comment #1? It seems already revealed where the problem is. Especially the dtb changes part…

Sorry, can you be more specific?
I do have a problem, but I don’t get a proper solution so far

Ok… let me just give you more hint…
From your comment:

DTB changes
File: hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-p3668-common.dtsi

sdhci_sd: sdhci@3400000 {
mmc-ocr-mask = <0x0>;
cd-inverted;

Additional DTB changed was:
hardware/nvidia/oc/t19x/kernel-dts/tegra194-soc/tegra194-soc-sdhci.dts
sdmmc3: sdhci@3440000 {
compatible = “nvidia,tegra194-sdhci”;

//status = “disabled”; //closed original line
status = “okay”;
}

Have you noticed the problem now?

looks like different addresses, thx, let me get back to work

That is why you can refer to other posts… they already shared the answer. Also, they even use the same GPIO as your case…

I still not sure how to solve an issue :-(

In tegra194-p3668-common.dtsi file I only have an “sdhci_sd: sdhci@3400000 {”
Here I probably need to define the proper GPIO under cd-gpios node and according to pinmux excel I did it right
On the other hand I got tegra194-soc-sdhci.dtsi I got “sdmmc3: sdhci@3440000 {”, but in the same file there is another entrance “sdmmc1: sdhci@3400000 {” - but this one is for sdmmc1.

Can you advice please, what is the proper solution?

Just add sdhci@3440000 node by yourself in the file you want to use.

Thanks!
I didn’t thought that I need to add node.
I did added a new node to hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-p3668-common.dtsi
Now it’s looks like this:

type osdhci_sd: sdhci@3400000 {
                mmc-ocr-mask = <0x0>;
                cd-inverted;
                cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(G, 7) 0>;
                nvidia,cd-wakeup-capable;
                mmc-ocr-mask = <0>;
                cd-inverted;
                vmmc-supply = <&p3668_vdd_sdmmc1_sw>;
                status = "okay";
        };

        sdhci_sd1: sdhci@3440000 { //added this node
                mmc-ocr-mask = <0x0>;
                cd-inverted;
                cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>;
                nvidia,cd-wakeup-capable;
                mmc-ocr-mask = <0>;
                cd-inverted;
                vmmc-supply = <&p3668_vdd_sdmmc1_sw>;
                status = "okay";
        };
r paste code here

Now I have a working SDCARD with working hot plug in/out.

Thank you for your support!

2 Likes

Hello ,

I would like to ask an additional question.
The thing is, that our HW eng made a small change to our custom board. As a result, I need to configure GPIO10 (pin 212, GPIO3_PQ.01) to be always output and high.

I made a small test. I edited /etc/rc.local and added the below lines to it:

echo 417 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio417/direction
echo 1 > /sys/class/gpio/gpio417/value

After the bootup, I can’t see SDCARD(it’s inserted).
But if I’m making a hot plug in event, I’m starting to see the SDCARD just fine.

Can you please advice me, how to solve this issue?