micro2440有一个配置是三星K9F2G08U0B--256MB SLC
tiny6410有一个配置是三星K9F2G086U0B--256MB SLC,有一个配置是三星K9K8G08U0B--1GB SLC,有一个配置是三星K9GAG08U0E--2GB MLC

1.
关于nand的ecc,refer to
http://www.amobbs.com/thread-5051907-1-1.html
Nand Flash本身是不具备ECC功能的,目前Micro有内置ECC功能的FLASH,不过市场上很难看到。
Nand Flash由于工艺原因,栅极存储的电荷会慢慢漏电,导致数据丢失;erase和program次数越多漏电的过程会加快。为了保证数据的可靠性,设计应用中都需要添加ECC功能模块来纠正Nand Flash内部的随机bit错误,以及电路上的随机错误。ECC功能由外部电路FPGA来完成,或者MCU的code来完成。
SLC的Datasheet上强调需要ECC纠正1bit错误。实际应用也确实如此,三星的SLC通常只发生1bit错误,很少有2bit以上的错误发生;intel的SLC 1bit,2bit错误都有很多。为了更可靠的数据,你可以采用纠正4bit或8bit的ECC算法,纠正bit数越多code越耗费时间和FPGA越耗费资源,ASIC也是。采用哪种ECC方式由设计者决定,通常你是不知道别人采用的ECC方式,除非他们告诉你。

2.
以K9F2G08xx--256MB SLC为例说明nandflash的内部结构:
可以看到,nandflash的构成方式是 页->块->device
每页2K+64B
每块64页
每个设备2048块

而每页的结构如下:
分为主区和空白区,主区用于存储真正的数据;空白区即传说的OOB(out of band带外数据),里面分了几个字节用于ECC(error correcting code 错误校验码)
main主区域,包含4个人扇区;空白区页包含4个扇区
OOB为spare区,除OOB第六字节外,通常至少把OOB的前3个字节存放Nand Flash硬件ECC码

1GB SLC的组成,与上面的page,block的结构一致,但是每块nand所含block增加。

2GB MLC的组成

nand flash是以页为单位读或写,是因为验证ecc时是整页验证的。以块为单位擦除,ubi里有个物理擦除块的概念,指的就是它。
--------没有子页时。

3
SLC和MLC的结构区别,一图以蔽之

4.
6410的nand接口及硬件ecc过程
tiny6410电路图接K9F2G08xx

6410的nand控制器
8.8 1-BIT / 4-BIT / 8-BIT ECC (ERROR CORRECTION CODE)
NAND flash controller has four ECC (Error Correction Code) modules for 1 bit ECC , one for 4bit ECC and one for
8bit ECC.
The 1bit ECC modules for main data area can be used for (up to) 2048 bytes ECC parity code generation, and 1
bit ECC module for spare area can be used for (up to) 4 bytes ECC Parity code generation.
Both 4bit and 8bit ECC modules can be used for only 512 bytes ECC parity code generation.
4 bit and 8bit ECC modules generate the parity codes for each 512 byte. However, 1 bit ECC modules generate
parity code per byte lane separately.
4bit ECC modules generate max 7byte parity codes and 8 bit ECC modules generate 13byteparity codes at each
512/24 bytes.
nand控制器有4个1bit-ecc模块,1个4bit-ecc模块,1个8bit-ecc模块
(Recommend: 1bit ECC for SLC, 4bit and 8bit ECC for MLC NAND Flash)--是因为MLC比SLC出错几率高
1bit-ecc 每2048B可校正1位错误数据,产生多少个字节校验码?
4bit-ecc 每512B可校正4位错误数据,最大产生7个字节校验码。一般的OOB可以提供如此多字节空间用于存储校验码。
8bit-ecc 每512B可校正8位错误数据,最大产生13个字节校验码

1bit ecc 编码和解码
8.8.2 1-BIT ECC PROGRAMMING ENCODING AND DECODING
1. To use 1-bit ECC in software mode, reset the ECCType to ‘0’ (enable 1-bit ECC)‘. ECC module generates
ECC parity code for all read / write data when MainECCLock (NFCONT[7]) and SpareECCLock (NFCONT[6])
are unlocked(‘0’). You must reset ECC value by writing the InitMECC (NFCONT[5]) and InitSECC
(NFCONT[4]) bit as ‘1’ and have to clear the MainECCLock (NFCONT[7]) bit to ‘0’(Unlock) before read or
write data.
MainECCLock (NFCONT[7]) and SpareECCLock(NFCONT[6]) bit controls whether ECC Parity code is
generated or not.
2. Whenever data is read or written, the ECC module generates ECC parity code on register NFMECC0/1.
3. After you complete read or write one page (does not include spare area data), Set the MainECCLock bit to ‘1’
(Lock). ECC Parity code is locked and the value of the ECC status register will not be changed.
4. To generate spare area ECC parity code, Clear SpareECCLock (NFCONT[6]) bit to ‘0’ (unlock).
5. Whenever data is read or written, the spare area ECC module generates ECC parity code on register
NFSECC.
6. After you complete read or write spare area, set the SpareECCLock bit to '1' (Lock). ECC Parity code is
locked and the value of the ECC status register will not be changed.
7. From now on, you can use these values to record to the spare area or check the bit error.
8. For example, to check the bit error of main data area on page read operation, after generating of ECC codes
for main data area, you have to move the ECC parity codes (is stored to spare area) to NFMECCD0 and
NFMECCD1. From this time, the NFECCERR0 have the valid error status values.
简解:
手动清零MainECCLock位,开启main区域的ecc硬件自动校验。
在cpu从nand main区上读取数据或者写入数据到nand main区时,ecc模块自动产生ecc校验码,放在寄存器NFMECC0/1里面.
当写完一页之后--- (一页的由自己定义,要按照nand说明书查看一页的大小,每页都有一个OOB用于存放该页的校验码),需要手动置MainECCLock 1,以便停止硬件ecc。此时寄存器NFMECC0/1的值将不会改变。

手动清零SpareECCLock 位,启动ecc spare区域的硬件自动校验。
在cpu从nand spare上读取数据或者写入数据到nand spare区时,ecc模块自动产生ecc校验码,放在寄存器NFSECC里面.
当写完nand spare区域之后,需要手动置SpareECCLock1,以便停止ecc spare区域的硬件自动校验。此时寄存器NFSECC的值将不会改变。

在写操作时,每写完一个页,就将NFMECC0/1的值写入nand的相应页的oob的某部分作为校验码。
在读操作时,每读完一页,就接着读取相应页的oob中的校验码,写入NFMECCD0/1寄存器,此时cpu会自动比较NFMECCD0/1和NFMECC0/1的值,结果存入NFECCERR0 寄存器。

5
ecc校验原理
http://blog.csdn.net/nhczp/article/details/1700031
http://blogimg.chinaunix.net/blog/upfile2/080702112233.pdf

转载于:https://www.cnblogs.com/-song/archive/2012/12/08/3331835.html

nand ubi -1 nand基础相关推荐

  1. nand ubi -4 kernel和mtd

    tiny6410 linux2.6.38 1.nand驱动 nand是作为平台设备,在板子文件mach-mini6410.c调用,系统启动时自动加载进内核 static struct platform ...

  2. nand ubi - 5 kernel和ubi

    ubi文件系统分析 http://download.csdn.net/detail/songqqnew/4919666 drivers/mtd/ubi/build.c mtd_devs是ubi卷和mt ...

  3. nand ubi -2 ubi管理下的SLC nand

    一 ubi管理下的SLC nand refer to http://www.linux-mtd.infradead.org/doc/ubi.html http://www.360doc.com/con ...

  4. nand ubi -3 uboot和ubi

    转载于:https://www.cnblogs.com/-song/archive/2012/12/07/3331836.html

  5. Nand分区及nand erase简解

    我的nand flash 32M,kernel 2.6.18, rootfs is emb  linux , cramfs. nand flash分区如下: static struct mtd_par ...

  6. linux nand 驱动,Linux NAND FLASH驱动分析(一)

    最近一直在忙着工作上的事情,好久都没有更新博客了,发现最近思想是比较混乱的.学任何东西都坚持不下去,既然选择驱动开发这条路就要坚持下去. 之前分析了Linux块设备驱动,是以内存块来模拟的虚拟块设备. ...

  7. linux dd nand,uboot 中 Nand flash 常用操作命令解释

    ar7240> mw.b 0x81000000 0xff 0x40000  (将RAM填充256K大小的FF) ar7240> nand read 0x81000000 0x1000 0x ...

  8. nand 与spi nand的重要区别

    两个在基本使用方面无太大区别,但是在spi nand 中有缓存器,需要使用13H命令读取页数据到缓存区,在使用其他读写命令进行操作,所以要注意页的读取和字节读取 1. 13h – PAGE READ ...

  9. linux 查看nand型号,linux nand flash常用命令

    使用命令前用cat /proc/mtd 查看一下mtdchar字符設備:或者用ls -l /dev/mtd* #cat /proc/mtd dev:    size   erasesize  name ...

最新文章

  1. python中列表实现自加减元素_python初学者知识整合
  2. MySQL 限制查询结果的记录数
  3. 正则表达式超级生成工具 Regulator
  4. Maven学习总结(26)——maven update时,报:Preference node org.eclipse.wst.validation...
  5. 《2021年度中国开发者有奖大调查》首批中奖名单火热出炉,下一个会是你吗?
  6. Golang编程语言简介 go语言特点
  7. Github上开源的数据可视化工具及作品分享(一)
  8. matlab 仿真步长,[转载]matlab 仿真步长设置
  9. mysql数据库的超级管理员名称_MySQL数据库的超级管理员名称是______
  10. 专属圣诞树+2022跨年HTML(腾讯云部署)
  11. Python生成n位随机数字字符串
  12. m与n的数字运算python_Python脚本基础运算和算法
  13. linux 安装nodejs
  14. [小白教程]动态调试工具Ollydbg的简单使用
  15. (株)FAU艾芙优连续五年荣获“韩国消费者评价第一”
  16. 安全驱动怎么设计(一)
  17. csdn图片去水印 | 其他方法无效时的解决方案
  18. HSV与HSI颜色空间的区别以及和RGB之间的转换
  19. [Linux转载]Linux 操作常用命令
  20. {‘errcode‘: 47001, ‘errmsg‘: ‘data format error rid} 微信测试号模板消息,参数不对。

热门文章

  1. windows上使用image库
  2. oracle trace文件解读
  3. Android Activity Launch Mode 启动模式详解
  4. android 将IE设为默认打开的浏览器
  5. android Math的使用
  6. DLmalloc 内存分配算法
  7. 拍拍贷信贷申请审核竞赛模拟
  8. Fliptile (dfs+二进制压缩)
  9. 练习-多表图书管理系统
  10. 基于NEO的私链(Private Blockchain)