hi3519v101 nandflash 调试

错误调试 1

保存uboot环境变量时出现下面的错误;
hisilicon # saveenv
Saving Environment to NAND...
Erasing Nand...
Warning: Erase size 0x00040000 smaller than one erase block 0x00100000
Erasing 0x00100000 instead
或者是:
hisilicon # saveenv
Saving Environment to NAND...
Erasing Nand...
MT29F16G08CBACA: MTD Erase failure: -22
Writing to Nand... done

错误分析:在写环境变量的时候,会把这个区的数据清空再写入,清空数据失败;

修改
这个值需要定义为当前存储器的block块大小的整数倍,不然会有上面的提升信息,需要擦除整个块数据。对于flash的分区也需要按块的最小单元的整数倍来分区。
在uboot/include/configs/hi3519v101_nand.h
/* env in flash instead of CFG_ENV_IS_NOWHERE */
#define CONFIG_ENV_OFFSET 0x800000 /* environment starts here */
#define CONFIG_ENV_NAND_ADDR (CONFIG_ENV_OFFSET)
#define CONFIG_ENV_SPI_ADDR (CONFIG_ENV_OFFSET)
#define CONFIG_CMD_SAVEENV

#define CONFIG_ENV_SIZE 0x100000 /*include ENV_HEADER_SIZE */
#define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE
#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */
/* kernel parameter list phy addr */
#define CFG_BOOT_PARAMS (MEM_BASE_DDR+0x0100)

错误调试 2

hisilicon # nand erase 1000000 500000
NAND erase: device 0 offset 0x1000000, size 0x500000
Skipping bad block at
0x01000000
Skipping bad block at
0x01100000
Skipping bad block at
0x01200000
Skipping bad block at
0x01300000
Skipping bad block at
0x01400000
OK

解决:
nand scrub 命令 把出厂的坏块标示全部清除掉,有一定风险,建议只在测试环境下使用。可能还会减少nand flash 的写寿命。
在uboot命令中,输入 nand scrub 命令即可。
hisilicon # nand scrub
NAND scrub: device 0 whole chip
Warning: scrub option will erase all factory set bad blocks!
There is no reliable way to recover them.
Use this command only for testing purposes if you
are sure of what you are doing!

Really scrub this NAND flash? <y/N>
Erasing at 0x5100000 -- 4% complete.
MT29F16G08CBACA: MTD Erase failure: -5
Block at 0x05a00000 is marked bad block

MT29F16G08CBACA: MTD Erase failure: -5
Block at 0x05b00000 is marked bad block
Erasing at 0x7ff00000 -- 100% complete.
OK

测试:
hisilicon # nand erase 1000000 500000
NAND erase: device 0 offset 0x1000000, size 0x500000
Erasing at 0x1400000 -- 100% complete.
OK
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值