Jetson Nano SD Card not working

Hello,

We have a custom carrier board that has a SD card on it for extra storage, we are using sdhci-tegra.2 for it. We have the card slot always powered by a rail outside of the jetson’s control.

I am not sure where I am going wrong but I can successfully see the card_detect going from 1 to 0 when I insert the SD card, I can also see the clock speed changing from 100,000 to 400,000 when the SD card is inserted. However, I am unable to see anything new show up in /dev or with fdisk -l.

We put a probe on the clock line and saw that the clock started running when we ejected the card but not when we inserted it. So the HW team swiched the resistor to pull high when the card was inserted instead of the normal active low, when we did this the card_detect never saw the change. So we stuck with the original Active Low HW design.

This is the device tree that we have been trying to implement (based on some other forum posts we saw):

#include <dt-bindings/platform/t210/t210.h
/ {
	sdhci@700b0400 {
		status = "okay";
		/delete-property/ keep-power-in-suspend;
		/delete-property/ non-removable;
		/delete-property/ nvidia,min-tap-delay;
		/delete-property/ nvidia,max-tap-delay;
		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>;
		nvidia,vmmc-always-on;
		regulator-always-on;
		mmc-ddr-1_8v;
		mmc-ocr-mask = <3>;
		uhs-mask = <0x0>;
		tap-delay = <3>;
	};
};

We also had to change the FAN_TACH gpio to get this to work.

Does anyone have experience with the device trees needed to get the SD card to work? We don’t need to boot from it (atleast for right now), just to use it for extra storage.

Joseph

/delete-property/ nvidia,min-tap-delay;
/delete-property/ nvidia,max-tap-delay;

You don’t need to deletet these two.

  mmc-ddr-1_8v;

And this one is not needed.

Also, even though you are using the always-on power source, you still need to give a always-on 3v3 power regulator to the vmmc-supply. Check “sdmmc3” over this forum and you will find lots of similar topics.

Thanks Wayne,

I change the DTSI file to be this instead based on what I found elsewhere:

#include <dt-bindings/platform/t210/t210.h>
/ {
	sdhci@700b0400 {
		status = "okay";
		/delete-property/ keep-power-in-suspend;
		/delete-property/ non-removable;
		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>;
		vmmc-supply = <&p3448_vdd_3v3_sys>;
		nvidia,vmmc-always-on;
		regulator-always-on;
		mmc-ocr-mask = <3>;
		uhs-mask = <0x0>;
		tap-delay = <3>;
	};
};

I still don’t see anything happen when I plug in the sd card, nothing in dmesg or in /dev/ only the card_detect and the clock speed change.

This is the compiled DTS after using dtc to decompile:

        sdhci@700b0400 {
                compatible = "nvidia,tegra210-sdhci";
                reg = <0x0 0x700b0400 0x0 0x200>;
                interrupts = <0x0 0x13 0x4>;
                aux-device-name = "sdhci-tegra.2";
                iommus = <0x30 0x1b>;
                nvidia,runtime-pm-type = <0x0>;
                clocks = <0x26 0x45 0x26 0xf3 0x26 0x136 0x26 0xc1>;
                clock-names = "sdmmc", "pll_p", "pll_c4_out2", "sdmmc_legacy_tm";
                resets = <0x26 0x45>;
                reset-names = "sdhci";
                status = "okay";
                tap-delay = <0x3>;
                trim-delay = <0x3>;
                mmc-ocr-mask = <0x0>;
                max-clk-limit = <0x61a80>;
                ddr-clk-limit = <0x2dc6c00>;
                bus-width = <0x4>;
                calib-3v3-offsets = <0x7d>;
                calib-1v8-offsets = <0x7b7b>;
                compad-vref-3v3 = <0x7>;
                compad-vref-1v8 = <0x7>;
                pll_source = "pll_p", "pll_c4_out2";
                ignore-pm-notify;
                cap-mmc-highspeed;
                cap-sd-highspeed;
                nvidia,en-io-trim-volt;
                nvidia,en-periodic-calib;
                cd-inverted;
                wp-inverted;
                pwrdet-support;
                pinctrl-names = "sdmmc_schmitt_enable", "sdmmc_schmitt_disable", "sdmmc_clk_schmitt_enable", "sdmmc_clk_schmitt_disable", "sdmmc_drv_code", "sdmmc_default_drv_code", "sdmmc_e_33v_enable", "sdmmc_e_33v_disable";
                pinctrl-0 = <0x8a>;
                pinctrl-1 = <0x8b>;
                pinctrl-2 = <0x8c>;
                pinctrl-3 = <0x8d>;
                pinctrl-4 = <0x8e>;
                pinctrl-5 = <0x8f>;
                pinctrl-6 = <0x90>;
                pinctrl-7 = <0x91>;
                vqmmc-supply = <0x3b>;
                vmmc-supply = <0x4c>;
                mmc-ddr-1_8v;
                uhs-mask = <0x0>;
                cd-gpios = <0x5b 0xca 0x1>;
                no-sdio;
                no-mmc;
                sd-uhs-sdr104;
                sd-uhs-sdr50;
                sd-uhs-sdr25;
                sd-uhs-sdr12;
                linux,phandle = <0xb8>;
                phandle = <0xb8>;
                prod-settings {
                        #prod-cells = <0x3>;

                        prod_c_ds {
                                prod = <0x100 0xff0000 0x10000 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x3000007d>;
                        };

                        prod_c_hs {
                                prod = <0x100 0xff0000 0x10000 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x3000007d>;
                        };

                        prod_c_sdr12 {
                                prod = <0x100 0xff0000 0x10000 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x30007b7b>;
                        };

                        prod_c_sdr25 {
                                prod = <0x100 0xff0000 0x10000 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x30007b7b>;
                        };

                        prod_c_sdr50 {
                                prod = <0x100 0xff0000 0x10000 0x1c0 0xe000 0x8000 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x30007b7b>;
                        };

                        prod_c_sdr104 {
                                prod = <0x100 0xff0000 0x10000 0x1c0 0xe000 0x4000 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x30007b7b>;
                        };

                        prod_c_ddr52 {
                                prod = <0x100 0x1fff0000 0x0 0x1e0 0xf 0x7 0x1e4 0x30077f7f 0x30007b7b>;
                        };

                        prod {
                                prod = <0x100 0x1fff000e 0x3090028 0x1c0 0x8001fc0 0x8000040 0x1c4 0x77 0x0 0x120 0x20001 0x1 0x128 0x43000000 0x0 0x1f0 0x80000 0x80000>;
                        };
                };
        };

Our team has a lack of Device Tree experience so I am sure there is something dumb we are missing.

So we are closer. With these changes I am able to see the sdcard with lsblk or fdisk, but only if the Jetson boots with the SD card inserted. Hot plugging doesn’t work.

Actually I spoke too soon. I was using the wrong carrier board that had the register flipped and pulling card detect high when I saw the lsblk work. It still only worked if the card was in the whole time though. Just trying to give all the information.

For such case, you can share the dmesg so that we can know what is going on.

With current description, I can only say something go wrong with your cd gpio.

Is there a part of the dmesg that help more than others? We have other devices that I would need to censor out of the dmesg before we can share. It will take me a minute to get that.

If the GPIO is supposed to be active low and we are seeing card_detect go to 0 when it is inserted, that is expected behavior right?

You can just inset the card and dump the full dmesg, attach it here.

If you are wondering about the inverting/non-inverting of the GPIO, you can add or remove cd-inverted properties to the device tree.

Here is the dmesg log.
There is no message when inserting or ejecting the sdcard. I did this a few times.

I will try the cd-inverted property as well. I tried that a while back, but I didn’t see a difference, but maybe with the other DTB changes you suggested it will work.

dmesg.log (55.1 KB)

Looks like the driver is getting the cd gpio.

[ 1.878898] sdhci-tegra sdhci-tegra.2: Got CD GPIO

Please probe the GPIO and see if it gets toggled when you insert the card.

Also, please check if your pinmux for the CD pin is correctly set.

I focused on just the CD GPIO and I believe I got it figured out. I had to remove cd-inverted and also change the cd-gpio to active high. Just changing one or the other didn’t work, I had to do both.

For anyone else who is struggling with the same issue, this is the device tree that ended up working for this board design:

#include <dt-bindings/platform/t210/t210.h>
/ {
	sdhci@700b0400 {
		status = "okay";
		/delete-property/ keep-power-in-suspend;
		/delete-property/ non-removable;
		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
		/delete-property/ cd-inverted;
		vmmc-supply = <&p3448_vdd_3v3_sys>;
		nvidia,vmmc-always-on;
		regulator-always-on;
		mmc-ocr-mask = <3>;
		uhs-mask = <0x0>;
		tap-delay = <3>;
	};
};
1 Like

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