TI中文支持网
TI专业的中文技术问题搜集分享网站

AM4378上移植K9F1G08U0C nand flash如何配置

#define CONFIG_SYS_NAND_PAGE_SIZE 2048
#define CONFIG_SYS_NAND_OOBSIZE 64
#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
CONFIG_SYS_NAND_PAGE_SIZE)
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
/* NAND: driver related configs */
#define CONFIG_NAND_OMAP_GPMC
#define CONFIG_NAND_OMAP_ELM
#define CONFIG_SYS_NAND_ONFI_DETECTION
#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH16_CODE_HW
#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, \
130, 131, 132, 133, 134, 135, 136, 137, 138, 139, \
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, \
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, \
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, \
170, 171, 172, 173, 174, 175, 176, 177, 178, 179, \
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, \
190, 191, 192, 193, 194, 195, 196, 197, 198, 199, \
200, 201, 202, 203, 204, 205, 206, 207, 208, 209, \
}
#define CONFIG_SYS_NAND_ECCSIZE 512
#define CONFIG_SYS_NAND_ECCBYTES 4

打印为:

U-Boot 2016.05 (Sep 27 2018 – 13:26:25 +0800)

I2C: ready
DRAM: 512 MiB
PMIC: TPS65218
WARNING: RTC not backed by battery!
Init vbus0: 500mA@5V, OFF
Init vbus1: 500mA@5V, ON
NAND: nand: error: insufficient OOB: require=106
0 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Error – No Valid Environment Area found
*** Warning – bad CRC, using default environment

Net: <ethaddr> not set. Validating first E-fuse MAC
Could not get PHY for cpsw: addr 1
Could not get PHY for cpsw: addr 4
Could not get PHY for cpsw: addr 1
Could not get PHY for cpsw: addr 4
Could not get PHY for cpsw: addr 6
cpsw, usb_ether
Hit any key to stop autoboot: 0

如果设置CONFIG_SYS_NAND_OOBSIZE 为224 能识别出Nand Flash但是读写总是报ECC错误

Shine:

CONFIG_SYS_NAND_OOBSIZE 为64, 要用BCH8,请看BCH和OOB的计算关系。
processors.wiki.ti.com/…/AM335x_U-Boot_User's_Guide

Jun Xiao97:

回复 Shine:

您好!感谢你的回复。我现在的配置是这样:
#ifdef CONFIG_NAND
/* NAND: device related configs */
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \CONFIG_SYS_NAND_PAGE_SIZE)
#define CONFIG_SYS_NAND_PAGE_SIZE 2048
#define CONFIG_SYS_NAND_OOBSIZE64
#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
/* NAND: driver related configs */
#define CONFIG_NAND_OMAP_GPMC
#define CONFIG_NAND_OMAP_GPMC_PREFETCH
#define CONFIG_NAND_OMAP_ELM
#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS

#define CONFIG_SYS_NAND_ECCPOS{ 2, 3, 4, 5, 6, 7, 8, 9, \10, 11, 12, 13, 14, 15, 16, 17, \18, 19, 20, 21, 22, 23, 24, 25, \26, 27, 28, 29, 30, 31, 32, 33, \34, 35, 36, 37, 38, 39, 40, 41, \42, 43, 44, 45, 46, 47, 48, 49, \50, 51, 52, 53, 54, 55, 56, 57, }

#define CONFIG_SYS_NAND_ECCSIZE512
#define CONFIG_SYS_NAND_ECCBYTES 14
#define CONFIG_SYS_NAND_ONFI_DETECTION
#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
#define MTDIDS_DEFAULT"nand0=nand.0"
#define MTDPARTS_DEFAULT"mtdparts=nand.0:" \"256k(NAND.SPL)," \"256k(NAND.SPL.backup1)," \"256k(NAND.SPL.backup2)," \"256k(NAND.SPL.backup3)," \"512k(NAND.u-boot-spl-os)," \"1m(NAND.u-boot)," \"256k(NAND.u-boot-env)," \"256k(NAND.u-boot-env.backup1)," \"8m(NAND.kernel)," \"-(NAND.rootfs)"
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00180000
结果跑起来就报错:
U-Boot 2016.05 (Sep 28 2018 – 10:13:04 +0800)

I2C:ready
DRAM:512 MiB
PMIC:TPS65218
WARNING: RTC not backed by battery!
Init vbus0: 500mA@5V, OFF
Init vbus1: 500mA@5V, ON
NAND:nand: error: insufficient OOB: require=106
0 MiB
MMC:OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Error – No Valid Environment Area found
*** Warning – bad CRC, using default environment

Net:<ethaddr> not set. Validating first E-fuse MAC
Could not get PHY for cpsw: addr 1
Could not get PHY for cpsw: addr 4
Could not get PHY for cpsw: addr 1
Could not get PHY for cpsw: addr 4
Could not get PHY for cpsw: addr 6
cpsw, usb_ether
Hit any key to stop autoboot:0
但是如果将:define CONFIG_SYS_NAND_OOBSIZE 64 改为define CONFIG_SYS_NAND_OOBSIZE 106或者更大就能识别出设备是128MiB但是用不了

Jun Xiao97:

回复 Shine:

将CONFIG_SYS_NAND_OOBSIZE 修改为106或更大就出现下面的结果(能够识别,但是读写就报ECC错误,现在的问题就是明明是64的OOB反而不对)
U-Boot 2016.05 (Sep 27 2018 – 16:09:05 +0800)

I2C:ready
DRAM:512 MiB
PMIC:TPS65218
WARNING: RTC not backed by battery!
Init vbus0: 500mA@5V, OFF
Init vbus1: 500mA@5V, ON
NAND:128 MiB
MMC:OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Error – No Valid Environment Area found
*** Warning – bad CRC, using default environment

Net:<ethaddr> not set. Validating first E-fuse MAC
Could not get PHY for cpsw: addr 1
Could not get PHY for cpsw: addr 4
Could not get PHY for cpsw: addr 1
Could not get PHY for cpsw: addr 4
Could not get PHY for cpsw: addr 6
cpsw, usb_ether
Hit any key to stop autoboot:0
MYIR>#
MYIR>#
MYIR># nand erase 0 40000

NAND erase: device 0 offset 0x0, size 0x40000
Erasing at 0x20000 — 100% complete.
OK
MYIR># nand write 82000000 0 40000

NAND write: device 0 offset 0x0, size 0x40000
omap-elm: uncorrectable ECC errors
omap-elm: uncorrectable ECC errors
NAND write to offset 0 failed -50 bytes written: ERROR

Jun Xiao97:

回复 Shine:

麻烦再帮忙想想办法。多谢!

Shine:

回复 Jun Xiao97:

请问用的是什么版本的SDK?

Shine:

回复 Jun Xiao97:

感谢分享解决方法。

ubi文件系统的烧写可以看一下下面的wiki网站。
processors.wiki.ti.com/…/UBIFS_Support

赞(0)
未经允许不得转载:TI中文支持网 » AM4378上移植K9F1G08U0C nand flash如何配置
分享到: 更多 (0)