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

AM335x更换nand后启动不了

最近按照客户需求扩大nand容量,之前自己做的AM335X板子使用镁光的4g容量MT29F4G08ABADA,这次更换为8g容量MT29F8G08ABACA。

4g容量的pagesize为2048b,obb大小64b,8g容量的pagesize为4096b,obb大小224b,请问修改uboot中nand配置需要注意些什么,我修改完使用sd卡烧写uboot

后断电重启,串口打CC,写操作每次都显示OK,但事实上没写成功,不知道什么原因

Eggsy Pang:

你的写操作是什么?怎么知道它没写成功?

在文件中 Am335x_evm.h (include\configs) 修改相关参数:

#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_OOBSIZE 64#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)

hongbin li1:

回复 Eggsy Pang:

感谢您的回复!  我使用SD卡启动到uboot下,使用nand write 写MLO,再使用nand read 读

U-Boot# nand write 0x81000000 0x0 0x20000

NAND write: device 0 offset 0x0, size 0x20000 131072 bytes written: OK

U-Boot# nand read 0x81000000 0x0 0x20000

NAND read: device 0 offset 0x0, size 0x20000

ECC: uncorrectable.ECC: uncorrectable.NAND read from offset 0 failed -74 0 bytes read: ERROR

您说的地方也都改了,看起来是ECC错误,那么ECC部分如何修改

#define CONFIG_SYS_NAND_PAGE_SIZE 4*1024 //2048#define CONFIG_SYS_NAND_OOBSIZE 224 //64#define CONFIG_SYS_NAND_BLOCK_SIZE (256*1024)//(128*1024)#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_ECCSIZE 512#define CONFIG_SYS_NAND_ECCBYTES 14

8g容量的nand手册上看到

Minimum required ECC 8-bit ECC per 540 bytes of data

标红的部分应该怎么改

Eggsy Pang:

回复 hongbin li1:

配置如下:

#define CONFIG_NAND_OMAP_ECCSCHEMEOMAP_ECC_BCH16_CODE_HW
#define CONFIG_SYS_NAND_ECCBYTES 26
#define CONFIG_SPL_NAND_AM33XX_BCH
#define CONFIG_SYS_NAND_ECCSIZE 512
#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, }

 在DT Bindings 配置

 ti,nand-ecc-opts="bch16"  ti,elm-id="<&elm> 

在KConfigs 配置CONFIG_MTD_NAND_OMAP_BCH=y

hongbin li1:

回复 Eggsy Pang:

我的UBOOT使用的是psp6.0中的u-boot-2013.01.01-psp06.00.00.00,没有使用设备树配置,对于我使用的uboot版本,如何添加BCH16的支持

Eggsy Pang:

回复 hongbin li1:

 先修改下面这些,uboot能正常驱动uboot了吗?

#define CONFIG_NAND_OMAP_ECCSCHEMEOMAP_ECC_BCH16_CODE_HW
#define CONFIG_SYS_NAND_ECCBYTES 26
#define CONFIG_SPL_NAND_AM33XX_BCH
#define CONFIG_SYS_NAND_ECCSIZE 512
#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, }

hongbin li1:

回复 Eggsy Pang:


U-Boot 2013.01.01 (May 05 2017 – 11:00:08)

I2C: readyDRAM: 512 MiBWARNING: Caches not enabledNAND: nand option: 0xdmaf_id:0x2cdev_id:0xd3ret:0 busw: 0byte2:0x90byte3:0xa6byte4:0x64byte5:0x0byte6:0x0byte7:0x0else busw:0NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit)NAND 1GiB 3,3V 8-bit, sector size 256 KiB Page size 4096 b OOB size 224 b Erase size 262144 bnand scan : ret 01024 MiBMMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1

按照您给的配置修改完,uboot卡在这了,而且看了下
#define CONFIG_NAND_OMAP_ECCSCHEMEOMAP_ECC_BCH16_CODE_HW
这个定义uboot中没有用到

Eggsy Pang:

回复 hongbin li1:

是这个CONFIG_NAND_OMAP_ECCSCHEME没定义
还是这个CONFIG_NAND_OMAP_ECCSCHEME 没定义 ?

hongbin li1:

回复 Eggsy Pang:

 CONFIG_NAND_OMAP_ECCSCHEME
是这个,整个uboot中没有用到这个定义

Eggsy Pang:

回复 hongbin li1:

check了一下,发现你用的这个版本的uboot和kernel都不支持BCH16,较新的PDK是可以支持的

To select ECC algorithm for NAND:

U-Boot# nandecc [sw | hw <hw_type>]

Usage:

sw – Set software ECC for NAND hw <hw_type> – Set hardware ECC for NAND <hw_type> – 0 for Hamming code 1 for bch4 2 for bch8 3 for bch16 Currently we support only Software, Hamming Code and BCH8. We do not support BCH4 and BCH16 

ECC schemes usage table
ECC schemes usage table

ComponentDefault ECC scheme used by the componentECC scheme to be used to flash the componentECC schemes supported by the component

SPL
BCH8
BCH8
BCH8

U-boot
Hamming
BCH8
Hamming/BCH8

Linux
BCH8
BCH8
BCH8

File System
NA
BCH8
NA

Environment variables
NA
Hamming
NA

hongbin li1:

回复 Eggsy Pang:

现在有点疑惑,am335x的ROM CODE是否支持镁光的MT29F8G08ABACA

1 page = (4K + 224 bytes)1 block = (4K + 224) bytes x 64 pages = (256K + 14K) bytes1 plane = (256K + 14K) bytes x 2048 blocks= 4320Mb1 LUN = 4320Mb x 2 planes= 8640Mbmanufacturer ID: 0x2cdevice ID      : 0xd3

赞(0)
未经允许不得转载:TI中文支持网 » AM335x更换nand后启动不了
分享到: 更多 (0)