Saving Environment to FAT... Card did not respond to voltage select!

在移植uboot到全志H3时,出现了错误:

Saving Environment to FAT... Card did not respond to voltage select!

判定与MMC有关。

同时还有报错:

Error: ethernet@1c30000 address not set.

No ethernet found.

查看源码发现这与环境变量有关(读不到MAC地址),进一步坐实了MMC的问题。

因为板子是自己设计的,只留了SD卡,没有EMMC,所以刚开始以为是虚焊等硬件问题,但进一步分析,既然都到这一步了,SD卡肯定是能正常使用的。

为了找到原因,这里使用orangepi pc plus(带EMMC)验证:

网口依然无法使用,并且出现错误:

Loading Environment from FAT... Unable to use mmc 1:1...

查看mmc:

mmc 1:1说明使用的是EMMC的第1分区,也就是说我想使用SD卡,但在后续板级初始化时,系统会更改MMC,而默认使用的是EMMC,所以需要将其更改SD卡。

找到出现错误的代码:

c 复制代码
static int env_fat_load(void)
{
	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
	struct blk_desc *dev_desc = NULL;
	disk_partition_t info;
	int dev, part;
	int err;

#ifdef CONFIG_MMC
	if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
		mmc_initialize(NULL);
#endif

	part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
					CONFIG_ENV_FAT_DEVICE_AND_PART,
					&dev_desc, &info, 1);	// 识别设备与分区
	if (part < 0)
		goto err_env_relocate;

	dev = dev_desc->devnum;
	if (fat_set_blk_dev(dev_desc, &info) != 0) {
		/*
		 * This printf is embedded in the messages from env_save that
		 * will calling it. The missing \n is intentional.
		 */
		printf("Unable to use %s %d:%d... ",	// 打印错误
		       CONFIG_ENV_FAT_INTERFACE, dev, part);
		goto err_env_relocate;
	}

	err = file_fat_read(CONFIG_ENV_FAT_FILE, buf, CONFIG_ENV_SIZE);
	if (err == -1) {
		/*
		 * This printf is embedded in the messages from env_save that
		 * will calling it. The missing \n is intentional.
		 */
		printf("Unable to read \"%s\" from %s%d:%d... ",
			CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part);
		goto err_env_relocate;
	}

	return env_import(buf, 1);

err_env_relocate:
	env_set_default(NULL, 0);

	return -EIO;
}

在出现错误之前,uboot会识别设备与其分区,通过宏"CONFIG_ENV_FAT_DEVICE_AND_PART"来定义,查看配置文件:

#define CONFIG_ENV_FAT_DEVICE_AND_PART "1:auto"

发现它确实被默认配置为EMMC启动,所以这里将1改为0,重新编译,orangepi和自己设计的板子均正常运行。

相关推荐
Zevalin爱灰灰8 分钟前
Linux入门第一部分(Ubuntu入门篇) 第三章 shell脚本入门(一)
linux·ubuntu·嵌入式
丘山望岳10 分钟前
Linux基础指令入门篇
linux·运维·服务器
笨笨饿14 分钟前
#143_屏幕画撕裂的问题及解决方法
linux·stm32·单片机·嵌入式硬件·mcu·lvgl·嵌入式实时数据库
小年糕是糕手22 分钟前
【AI】用 Python 做一个 AI 截图检索助手:把收藏夹里的截图找回来
linux·人工智能·python·chatgpt·agent·codex·deepseek
hhhjhl27 分钟前
Zod 跨端三方库仓颉适配全流程
linux·运维·ubuntu
叼烟扛炮42 分钟前
Linux 学习笔记(三十二):线程控制——创建、等待与分离
linux·运维·服务器·笔记·学习·1024程序员节
夜雪一千1 小时前
Linux 权限、用户、用户组内容介绍
linux·运维·服务器
拂拉氏1 小时前
【知识讲解】 Linux信号的认识与使用
linux·信号
无毁的湖光-Al1 小时前
高可用之路-观测篇-那些年遇到过的指标幻觉
linux·数据库·tcp
叼烟扛炮1 小时前
Linux 学习笔记(二十九):进程信号(上)—— 信号捕捉与异步魔法
linux·运维·笔记·学习·1024程序员节