当前位置: 首页 > news >正文

20250517让NanoPi NEO core开发板在Ubuntu core16.04.2下支持TF卡的热插拔

20250517让NanoPi NEO core开发板在Ubuntu core16.04.2下支持TF卡的热插拔
2025/5/17 17:52


缘起:实测NanoPi NEO core开发板上电之后,后插入的TF卡不认/不支持热插拔。
Ubuntu core16.04.2
Ubuntu core20.04
Ubuntu core16.04.3


用NanoPi NEO core开发板 接入4G模块EC200A-CN。
有一个移远提供的上网应用程序:quectel-CM需要拷贝到Ubuntu core系统中。
【还没有来得及集成到IMG固件/系统中】

不想使用RJ45以太网线了!
插上网线是可以通过DHCP自动分配局域网的IP地址。
然后通过ssh/scp、samba就可以拷贝文件进去了!

如果H3通过EMMC启动,上电之后再插入 有程序的TF卡 拷贝文件。
系统启动完成之后就不会/不识别你所插入的TF卡。
必须上电之前插入?
linux内核是支持 热插拔的呀?
感觉是你们/友善之臂没有做好!

现在使用的ubuntu core 20.04测试的。
记忆中ubuntu core 16.04.2/Ubuntu22.04.2都有这个问题的。


貌似Android系统是有一个daemon应用程序,一秒钟扫描一次是否有TF卡插入。
在H3上做一个这种daemon应用程序很简单的!


我们只提供底层软件和基础的系统,因为不同客户需求是不同的,
至于自动挂载,按需自行配置udev规则即可,或者有些systemd服务可以达到同样的目的,
怀疑linux内核没有识别SD插入,可以打印一下dmesg信息看看。


【贵司邮件服务器异常,从2025-05-10开始不接受带附件的E-MAIL了!^_无法 发送附加了】

NanoPi NEO core开发板在ubuntu core22.04.3下
查看/比对了一下插入前后的dmesg,发现/确认你们提供的kernel:linux内核没有识别SD插入。
由于对SD/TF卡的热插拔检测是很基本的功能,我希望贵司最好能够加入这个功能。
2015年,我就开始做全志R16的FAE,和A33/H3同一个级别的SOC。
记得当时全志R16在Android4.4.2/tina下都可以支持SD/TF卡的热插拔的。

至少可以提供一下方向,让我知道该如何加入?


参考资料:
https://blog.51cto.com/u_16099268/13875998
Android TF卡热拔插


https://blog.csdn.net/fun_tion/article/details/142613803
嵌入式Linux系统TF卡热插拔检测问题

是否是因为没有配置SDHCI_EXT_CD检测引脚?或者没有配置正确呢?

root@NanoPi-NEO-Core:/# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl:
 gpio-10  (                    |status_led          ) out lo   
 gpio-204 (                    |usb0_id_det         ) in  hi IRQ

gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl:
 gpio-354 (                    |usb0-vbus           ) out lo   
 gpio-355 (                    |k1                  ) in  hi IRQ
 gpio-358 (                    |?                   ) out lo   
 gpio-360 (                    |vcc1v2              ) out hi   
 gpio-361 (                    |vcc-dram            ) out hi   
 gpio-362 (                    |LED2                ) out hi   
root@NanoPi-NEO-Core:/#


非常抱歉,由于一些历史原因,我们提供的系统默认禁用了 TF卡插拔检测。
用户可以参考下面这个 commit 的内容,自行使能该特性:
https://github.com/friendlyarm/linux/commit/6fe15de8c8d042677b2962fe06c15f3c3f017ae7


https://github.com/friendlyarm/linux/commit/6fe15de8c8d042677b2962fe06c15f3c3f017ae7

1 file changed
+1
-2
lines changed
Search within code
 
?arch/arm/boot/dts/sun8i-h3-nanopi.dtsi
+1
-2
Original file line number    Diff line number    Diff line change
@@ -283,8 +283,7 @@

&mmc0 {
    bus-width = <4>;
    cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
    cd-inverted;
    non-removable;
    pinctrl-names = "default";
    pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
    boot_device = <0>;


Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi-neo-core.dts

Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi - 副本.dtsi
&mmc0 {
    bus-width = <4>;
    non-removable;
    pinctrl-names = "default";
    pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
    boot_device = <0>;
    status = "okay";
    vmmc-supply = <&reg_vcc3v3>;
};

修改成为:
Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi.dtsi
&mmc0 {
    bus-width = <4>;
    cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
    cd-inverted;
    //non-removable;

    pinctrl-names = "default";
    pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
    boot_device = <0>;
    status = "okay";
    vmmc-supply = <&reg_vcc3v3>;
};


确认DTS的编译结果:
Z:\61临时了sd-fuse_h3\kernel\arch\arm\boot\dts\.sun8i-h3-nanopi-neo-core.dtb.dts.tmp

&mmc0 {
 bus-width = <4>;
 non-removable;
 pinctrl-names = "default";
 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
 boot_device = <0>;
 status = "okay";
 vmmc-supply = <&reg_vcc3v3>;
};


Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\.sun8i-h3-nanopi-neo-core.dtb.dts.tmp

&mmc0 {
 bus-width = <4>;
 cd-gpios = <&pio 5 6 0>;
 cd-inverted;

 pinctrl-names = "default";
 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
 boot_device = <0>;
 status = "okay";
 vmmc-supply = <&reg_vcc3v3>;
};


更新zImage和sun8i-h3-nanopi-neo-core.dtb文件,打包boot.img之后:更新:
Z:\sd-fuse_h3\kernel\arch\arm\boot\dts\sun8i-h3-nanopi-neo-core.dtb
Z:\sd-fuse_h3\BOOT\sun8i-h3-nanopi-neo-core.dtb

F:\zImage
H:\friendlycore\boot.img


LOG/dmesg比对:

[    9.389957] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    9.439609] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    9.492517] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   43.113836] mmc1: host does not support reading read-only switch, assuming write-enable
[   43.115915] mmc1: new high speed SDHC card at address b368
[   43.117776] mmcblk1: mmc1:b368 SDABC 29.1 GiB 
[   43.119536]  mmcblk1: p1

[   55.087946] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   55.153190] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
root@NanoPi-NEO-Core:/# dmesg


挂载/热插拔TF卡:
root@NanoPi-NEO-Core:/# 
root@NanoPi-NEO-Core:/# fdisk -l
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2294ea6c

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        49152   131071    81920   40M 83 Linux
/dev/mmcblk0p2       131072  2621439  2490368  1.2G 83 Linux
/dev/mmcblk0p3      2621440 15269887 12648448    6G 83 Linux


Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk1: 29.1 GiB, 31273779200 bytes, 61081600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdca40288

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk1p1       8192 61081599 61073408 29.1G  c W95 FAT32 (LBA)

root@NanoPi-NEO-Core:/# 
root@NanoPi-NEO-Core:/# 
root@NanoPi-NEO-Core:/# mount /dev/mmcblk1p1 /mnt
root@NanoPi-NEO-Core:/# 
root@NanoPi-NEO-Core:/# cd /mnt/
root@NanoPi-NEO-Core:/mnt# 
root@NanoPi-NEO-Core:/mnt# ls -l
total 615936
-rwxr-xr-x 1 root root      1936 Aug  8  2015 default.script1
-rwxr-xr-x 1 root root       852 Jun 18  2021 default.script2
drwxr-xr-x 3 root root     32768 May  9  2025 etc
drwxr-xr-x 2 root root     32768 May  8  2025 linux-ppp-scripts
-rwxr-xr-x 1 root root    183564 Mar 30  2024 quectel-CM

-rwxr-xr-x 1 root root 630311248 May 10  2025 rootfs.tar.gz
drwxr-xr-x 2 root root     32768 May  8  2025 System Volume Information
drwxr-xr-x 3 root root     32768 May  9  2025 usr
root@NanoPi-NEO-Core:/mnt# 

相关文章:

  • StarRocks MCP Server 开源发布:为 AI 应用提供强大分析中枢
  • Seata源码—5.全局事务的创建与返回处理一
  • 【AI生成PPT】使用ChatGPT+Overleaf自动生成学术论文PPT演示文稿
  • MySql进阶学习
  • PHP8.0版本导出excel失败
  • 长三角、珠三角、成渝、京津冀四大城市群的区域与分布
  • ubuntu安装google chrome
  • 如何在 Windows 10 或 11 上通过命令行安装 Node.js 和 NPM
  • 06、基础入门-SpringBoot-依赖管理特性
  • golang中的反射示例
  • Java二叉树题目练习
  • 项目QT+ffmpeg+rtsp(二)——海康威视相机测试
  • Rust 学习笔记:关于 HashMap 的练习题
  • PostGIS实现栅格数据入库-raster2pgsql
  • [Java][Leetcode simple] 13. 罗马数字转整数
  • SLAM定位常用地图对比示例
  • 系分论文《论系统需求分析方法及应用》
  • Redis深度解析:高性能内存数据库的核心原理与应用实践
  • Rhino 8 犀牛保姆级安装教程
  • 常见的实时通信技术(轮询、sse、websocket、webhooks)
  • 江西4人拟任县(市、区)委书记,其中一人为“80后”
  • 俄媒:俄乌代表团抵达谈判会场
  • 中国首艘海洋级智能科考船“同济”号试航成功,可搭载水下遥控机器人
  • 悬疑剧背后的女编剧:创作的差异不在性别,而在经验
  • 河南信阳:对违规吃喝问题不遮丑不护短,露头就打、反复敲打
  • 普京召开俄乌谈判筹备会议,拉夫罗夫、绍伊古等出席