加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

nandflash操作命令

发布时间:2020-12-15 20:02:42 所属栏目:百科 来源:网络整理
导读:??nandflash 操作命令主要是 flash 擦除,读,写 ,ecc 校验等命令 ??nand?info?:?? 查看 nandflash 芯片信息包括数据线位宽一般 8 或者是 16 等 ??nand?erase:??nandflash 使用之前必须先擦除 , 遇到坏块会标记以下是使用实例 ?????????????nand?erase?0x002


??nandflash操作命令主要是flash擦除,读,写,ecc校验等命令

??nand?info?:??查看nandflash芯片信息包括数据线位宽一般8或者是16

??nand?erase:??nandflash使用之前必须先擦除,遇到坏块会标记以下是使用实例

?????????????nand?erase?0x00280000?0x300000

? ? ? ? 作用:擦除nandflash上起始地址为0x00280000,长度为0x300000flash空间

??nand?scrub:?作用和nand?erase差不多,但是会将坏块信息也擦除掉
??

??nand?write:??将数据从ddr上的某个地址写入flash中间比如

?????????????nand?write?0x81000000?0x00280000?0x300000

? ? ? ? 作用:将DDR地址为0x81000000上的数据写入到nandflash?地址0x00280000上,写入长度为0x30000

??nandecc??:?在读写flash之前需要先设置好该flashecc校验方法,否则可能导致很严重的错误,

? ? ? ?以下是设置ecc校验的命令

? ? ? ? ? ? ? ? nandecc?hw?2设置nandflashecc校验是硬件校验具体为BCH8(4位校验码)

????????????nandecc?hw?0设置nandflash的校验方法是硬件校验具体是汉明码(1位校验码)

????????????nandecc?sw?设置nandflash的校验方法是软件校验



NAND ECC algorithm selection

NAND flash memory,although cheap,suffers from problems like bit flipping which lead to data corruption. However by making use of some error correction coding (ECC) techniques it is possible to work around this problem.

For the data stored in NAND flash,U-Boot supports following NAND ECC schemes

  1. S/W ECC (Hamming code)
  2. H/W ECC (Hamming code,BCH4,BCH8,BCH16)

Current releases do not support BCH4 and BCH16.

BCH Flash OOB Layout

For any ECC scheme we need to add some extra data while writing so as to detect and correct (if possible) the errors introduced by the NAND part. In case of BCH scheme some bytes are needed to store the ECC related info.

The section of NAND memory where addition info like ECC data is stored is referred to as Out Of Band or OOB section.

The first 2 bytes are used for Bad block marker – 0xFFFF => Good block

The next ‘N’ bytes is used for BCH bytes

N = B * <Number of 512-byte sectors in a page>

  B =  8 bytes per 512 byte sector in BCH4
B = 14 bytes per 512 byte sector in BCH8 
B = 26 bytes per 512 byte sector in BCH16

So for a 2k page-size NAND flash with 64-byte OOB size,we will use BCH8. This will consume 2 + (14*4) = 58 bytes out of 64 bytes available.

The NAND flash part used in EVM does not have enough spare area to support BCH16.

ECC Schemes and their context of usage
ECC type Usage
S/W ECC Not used
H/W ECC - Hamming Code Should use this scheme while flashing any image/binary which will be used by Linux. This is also used for the U-Boot ENV variables.
H/W ECC – BCH8 Only while flashing U-Boot from U-Boot already running out of OCMC RAM1. After flashing revert back to hamming code H/W ECC


To select ECC algorithm for NAND:

TI8148_EVM# 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读