项目场景:
讯为的IMX6Q开发板2G+16G配置
ubuntu18.04环境
讯为android6.0源码
问题描述:
使用讯为官方Android6.0源码编译uboot,通过TF卡启动,报错MMC: no card present/MMC init failed
求助讯为官方支持无果,只好自己琢磨了,报错内容如下
U-Boot 2015.04 (Feb 23 2022 - 17:31:04)
CPU: Freescale i.MX6Q rev1.5 at 792 MHz
CPU: Temperature 17 C
Reset cause: POR
Board: MX6-SabreSD
I2C: ready
DRAM: 2 GiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
MMC: no card present
MMC init failed
Using default environment
*** Warning use default panel:9.7 ***
MMC: no card present
MMC init failed
LCD type:9.7
MMC: no card present
MMC init failed
bootsystem:android
bootargs=console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=256M init=/init video=mxcfb0:dev=ldb,VGA_1024768 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=384M
Display: 9.7 (1024x768)
In: serial
Out: serial
Err: serial
MMC: no card present
Net: FEC [PRIME]
Normal Boot
Hit any key to stop autoboot: 0
原因分析及解决:
通过网上搜索资料,大概确定是因为SD卡的CD引脚未正常检测到的原来,查看mx6sabresd.c文件,发现SD卡引脚配置如下
static iomux_v3_cfg_t const usdhc2_pads[] = {
MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D4__SD2_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D5__SD2_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D6__SD2_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D7__SD2_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D2__GPIO2_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
};
配置的是MX6_PAD_NANDF_D2__GPIO2_IO02 引脚,然后查看原理图发现如下
CD引脚为KEY_COL7,继续查找,核心板连接如下
问题就出现了,核心板连接的是GPIO_4,然后查看手册发现
正确引脚应该是GPIO1_4,所以修改mx6sabresd.c文件如下
static iomux_v3_cfg_t const usdhc2_pads[] = {
MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D4__SD2_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D5__SD2_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D6__SD2_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_NANDF_D7__SD2_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
// MX6_PAD_NANDF_D2__GPIO2_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
MX6_PAD_GPIO_4__GPIO1_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
};
#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
#define USDHC3_CD_GPIO IMX_GPIO_NR(2, 0)
修改之后重新编译,再烧写uboot到sd卡,上电启动终于正常了
U-Boot 2015.04 (Feb 23 2022 - 18:07:20)
CPU: Freescale i.MX6Q rev1.5 at 792 MHz
CPU: Temperature 36 C
Reset cause: POR
Board: MX6-SabreSD
I2C: ready
DRAM: 2 GiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
LCD type:9.7
bootsystem:android
bootargs=console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=256M init=/init video=mxcfb0:dev=ldb,VGA_1024768 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=384M
Display: 9.7 (1024x768)
In: serial
Out: serial
Err: serial
switch to partitions #0, OK
mmc0 is current device
Net: FEC [PRIME]
Normal Boot
Hit any key to stop autoboot: 0
=> mmc info
Device: FSL_SDHC
Manufacturer ID: 0
OEM: 0
Name: SMISD
Tran Speed: 50000000
Rd Block Len: 512
SD version 1.10
High Capacity: No
Capacity: 477.5 MiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
=> mmc list
FSL_SDHC: 0 (SD)
FSL_SDHC: 1
FSL_SDHC: 2
=>
大功告成,哈哈
版权声明:本文为u012988644原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。