MicroSD card not detected on Jetson Nano production module

Hi,

We have a custom-made carrier board for the new Jetson Nano production modules that we are working on. We use the flash.sh script to flash the internal eMMC, using the command:
sudo ./flash.sh jetson-nano-emmc mmcblk0p1

The carrier board we use does not have USB or HDMI connections, only a mini-USB port for operating in USB recovery mode for flashing purposes. Hence we have to rely on a default user creation script we found on this forum to skip System Configuration after first boot, and the flash script. I was wondering if something was going wrong with the flashing script, because the device /dev/mmcblk1 is not created (as observed on running ‘df -h’), even though the microSD card is inserted into the slot provided on the carrier board. The partition on the microSD card is ext4, and it is detected on the Ubuntu running on my desktop.

The dmesg output also does not update when the microSD card is inserted. Below is the output when I run ‘lsblk’:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 16M 1 loop
mmcblk0 179:0 0 14.7G 0 disk
├─mmcblk0p1 179:1 0 14G 0 part /
├─mmcblk0p2 179:2 0 128K 0 part
├─mmcblk0p3 179:3 0 448K 0 part
├─mmcblk0p4 179:4 0 576K 0 part
├─mmcblk0p5 179:5 0 64K 0 part
├─mmcblk0p6 179:6 0 192K 0 part
├─mmcblk0p7 179:7 0 384K 0 part
├─mmcblk0p8 179:8 0 64K 0 part
├─mmcblk0p9 179:9 0 448K 0 part
├─mmcblk0p10 179:10 0 448K 0 part
├─mmcblk0p11 179:11 0 64M 0 part
├─mmcblk0p12 179:12 0 64K 0 part
├─mmcblk0p13 179:13 0 80K 0 part
└─mmcblk0p14 179:14 0 128K 0 part
mmcblk0rpmb 179:32 0 4M 0 disk
zram0 252:0 0 495.4M 0 disk [SWAP]
zram1 252:1 0 495.4M 0 disk [SWAP]
zram2 252:2 0 495.4M 0 disk [SWAP]
zram3 252:3 0 495.4M 0 disk [SWAP]

The command ‘fdisk -l’ also does not show a partition apart from the ones on the internal eMMC and the RAM. Can anyone please suggest as to how to debug this? Does the image being flashed does not support SD card memory? We are using a modified kernel btw, with a driver to support our camera. But I am not sure if this is responsible in any way.

Hi jetson_user,

Yes, I think it is little bit too soon to say it is an issue from the configuration script.

By default, the sdmmc on tegra is only enabled for sdmmc4 which is for emmc. As you could see the OEM Design guide says “Not assigned” for the sdcard usage on Devkit carrier.

So the debug method should be

  1. Find one HDMI and keyboard

  2. Enable the sdhci@700b0000 status to “okay” in either tegra210-p3448-0002-p3449-0000-a02.dts or tegra210-p3448-0002-p3449-0000-b00.dts which depends on your flash config.

  3. Check if sdcard can work or not. If not work,please attach the dmesg.

Hi WayneWWW,

Thank you for your response. I tried the mentioned steps. I found that during flashing only tegra210-p3448-0002-p3449-0000-b00.dtb was being copied into the rootfs, so I assumed the correct file was tegra210-p3448-0002-p3449-0000-b00.dts. I enabled the sdhci@700b0000 status in this file, and built the kernel (obtained from L4T 32.2 public sources), and flashed again. The results were the same, the SD card was not detected. To be safe, I also tried with the same modification in tegra210-p3448-0002-p3449-0000-a02.dts, which also did not work. Please find attached the dmesg.
dmesg_sd_card_not_detected.txt (53.8 KB)

Just to add a few things, I went through the discussions here:

https://devtalk.nvidia.com/default/topic/1051397/jetson-nano-flash-image/?offset=5
https://devtalk.nvidia.com/default/topic/1060943/jetson-nano/emmc-chip-on-sdmmc3/

And after going through the source code a bit, I saw the dts files all refer to SDMMC1 for the external SD card, which was the case for Nano dev., but for the Nano production module it should be SDMMC3. Is there a need to change to SDMMC3? If yes, how?

Hi jetson_user,

The sdmmc_vdd_en does not have a gpio and also the sdmmc_CD. Please check if you write it to the device tree.

Hi,

The SDMMC_VDD_EN signal is always enabled on the carrier board I am using. I think I remember from the datasheet for Jetson Nano production module, GPIO pin 208 is assigned to SDMMC_CD (this is the card detect signal I hope). Is it so?

But I could observe a change in the voltage level of this pin (active low by default to active high) when an SD card is inserted.

How do I check a write to the device tree? Could I please get some specifics? Also, which other dts and dtsi files should I verify? Is there like a pinout I could verify inside the device tree? I still seem to be confused about the SDMMC1 being referred to as the SD card port, which was true for Nano development, but not for production module, which has SDMMC3 port for SD card. This was particularly inside the file:
sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi

Hi jetson_user,

I think you might be right about the sdmmc3 in device tree. I will check with internal team to check why there is such comment in source code.

As for checking device tree, you could check it during runtime by the node /proc/device-tree on your nano.

Hi jetson_user,

Yes, please enable sdhci@700b0400 in device tree. That is sdmmc3. The comment in device tree is not correct for production nano.

Also, the patch is needed.

---

diff --git a/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
index 67283d4..bad9b67 100644
--- a/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
+++ b/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
@@ -308,7 +308,8 @@
 			override@1 {
 				target = <&sdhci2>;
 				_overlay_ {
-					vmmc-supply = <&max77620_ldo6>;
+					status = "okay";
+					vqmmc-supply = <&max77620_ldo6>;
 					no-sdio;
 					no-mmc;
 					sd-uhs-sdr104;
diff --git a/kernel-dts/tegra210-porg-p3448-common.dtsi b/kernel-dts/tegra210-porg-p3448-common.dtsi
index 4e0f741..4be84f9 100644
--- a/kernel-dts/tegra210-porg-p3448-common.dtsi
+++ b/kernel-dts/tegra210-porg-p3448-common.dtsi
@@ -256,6 +256,11 @@
 		status = "disabled";
 		/delete-property/ keep-power-in-suspend;
 		/delete-property/ non-removable;
+		mmc-ddr-1_8v;
+		mmc-ocr-mask = <3>;
+		uhs-mask = <0x0>;
+		max-clk-limit = <400000>;
+		tap-delay = <3>;
 	};
 
 	sdhci@700b0200 { /* SDMMC2 for Wifi */

Thanks for the response. By enabling sdhci@700b0400 in device tree you mean :

“Enable the sdhci@700b0000 status to ‘okay’ in tegra210-p3448-0002-p3449-0000-b00.dts”,

right?

oops, no , I meant “sdhci@700b0400”

Hi WayneWWW,

It worked, thank you!

I am using the source code from: L4T 32.2 public sources (Jetson Nano), and the paths for the files mentioned in the patch are different, so I applied those changes manually. Summarizing what I did:

  1. Set status for sdhci@700b0400 to “okay” in:

sources/hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-p2530-common.dtsi
sources/hardware/nvidia/platform/t210/common/kernel-dts/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi

  1. Patch changes applied manually in:

sources/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi

sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi

I hope these are the required and correct changes. If not, please let me know.

The SD card was not listed when I ran ‘df -h’ after boot, i.e., it was not automounted. So I had to manually mount it to a specific location, for instance, /mnt, using the command:
sudo mount /dev/mmcblk1p1 /mnt -o defaults,rw

Maybe this is an ownership thing? We could look into this further, but if you have a quick fix, please let us know. For now, I am accepting your answer.

How about using fstab?
https://help.ubuntu.com/community/Fstab

Hi WayneWWW,

I did not yet implement auto-mount-sd-card-on-startup by changing fstab. I plan to have a script (do not have it yet) which before running my startup application would mount the /dev/mmcblkp1 (sd card partition) at $HOME/sd_card location. But at the moment I do this manually. It seems the sd card mounting works, but the device takes a long time to boot when the sd card is kept inserted. Here’s the output of systemd-analyze time:

Startup finished in 11.261s (kernel) + 2.454s (userspace) = 13.715s
multi-user.target reached after 2.423s in userspace

However, I noticed that after power on from a completely powered off state, it takes around 2 min 45 seconds to boot.

The reboot command is however faster, happens in 30 seconds! Similar to the case when no SD card is inserted, and irrespective of whether the SD card patch is applied or not.

Could you shed some light on what might be happening here?

Since the kernel code was modified owing to an additional driver I am using, I had to change the patch slightly. Please find it below.

diff --git a/hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-p2530-common.dtsi b/hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-p2530-common.dtsi
--- a/hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-p2530-common.dtsi	2019-09-18 13:21:25.000000000 +0200
+++ b/hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-p2530-common.dtsi	2019-09-18 13:26:22.723470000 +0200
@@ -131,7 +131,7 @@
 		uhs-mask = <0x1c>;
 		power-off-rail;
 		nvidia,update-pinctrl-settings;
-		status = "disabled";
+		status = "okay";
 	};
 
 	sdhci@700b0200 {
diff --git a/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
--- a/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi	2019-09-18 13:21:25.000000000 +0200
+++ b/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi	2019-09-18 13:28:08.251948000 +0200
@@ -313,7 +313,8 @@
 			override@1 {
 				target = <&sdhci2>;
 				_overlay_ {
-					vmmc-supply = <&max77620_ldo6>;
+					status = "okay";
+					vqmmc-supply = <&max77620_ldo6>;
 					no-sdio;
 					no-mmc;
 					sd-uhs-sdr104;
diff --git a/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi b/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
--- a/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi	2019-09-18 13:21:25.000000000 +0200
+++ b/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi	2019-09-18 13:30:00.344454000 +0200
@@ -250,9 +250,14 @@
 	};
 
 	sdhci@700b0400 {
-		status = "disabled";
+		status = "okay";
 		/delete-property/ keep-power-in-suspend;
 		/delete-property/ non-removable;
+		mmc-ddr-1_8v;
+		mmc-ocr-mask = <3>;
+		uhs-mask = <0x0>;
+		max-clk-limit = <400000>;
+		tap-delay = <3>;
 	};
 
 	sdhci@700b0200 { /* SDMMC2 for Wifi */

P.S. I still boot from the internal flash memory and plan to use the SD card to store data which my startup application generates on specific conditions.

Since the above question is not related to the main topic of this thread, a separate thread has been created for it, here: https://devtalk.nvidia.com/default/topic/1065480/jetson-nano/jetson-nano-production-module-takes-long-time-to-boot-when-sd-card-is-inserted/.

hi , jetson user.
did you complete follow the jeson_nano_product_design_guide about the SD card schematic?
how does jetson_nano handle the SD_DETECT? When TF inserted, should it gene a posedge or negedge on GPIO08?

Hi gzh886,

I did not look into the hardware design. I just know that the DETECT signal goes to GPIO_08 (= GPIO_PZ2). By default this signal is HIGH but when SD card is inserted it goes low. Sorry if this doesn’t help because I do not know much about the hardware design.