分类:
2009-01-28 12:02:13
作者:
以前一直使用别人成功的FMD,早几天对一些细节以及编程方法一无所知,同时也有很多人问我flash相关问题,我好想在论坛指点江山,给养技术,可是感觉有些东西确实需要补补,今天就看个明白吧。
NAND Flash Technical Notes
Invalid Block(s)
Invalid
blocks are defined as blocks that contain one or more invalid bits
whose reliability is not guaranteed by Samsung. The infor-
mation
regarding the invalid block(s) is so called as the invalid block
information. Devices with invalid block(s) have the same quality
level
or as devices with all valid blocks and have the same AC and DC
characteristics. An invalid block(s) does not affect the perfor-
mance of valid block(s) because it is isolated from the bit line and the common source line by a select transistor. The system design
must be able to mask out the invalid block(s) via address mapping.(系统必须标记坏块) The
1st block, which is placed on 00h block address, is fully guaranteed to
be a valid block, does not require Error Correction.(第一个block也就是00h
block地址,厂家会保证绝对是好的,不用检查标记)
Identifying Invalid Block(s) 标记坏块
All
device locations are erased(FFh) except locations where the invalid
block(s) information is written prior to shipping. The invalid block(s)
status is defined by the 6th byte in the spare area. Samsung makes sure
that either the 1st or 2nd page of every invalid
block has non-FFh data at the column address of 517.(这是生产过程中产生的坏块,一般芯片原厂都会在出厂时都会将坏块第一个page的spare area的第6个byte标记为不等于0xff的值。) Since the invalid block information is also erasable in most cases, it is impos-
sible
to recover the information once it has been erased. Therefore, the
system must be able to recognize the invalid block(s) based
on the
original invalid block information and create the invalid block table
via the following suggested flow chart(Figure 4). Any inten-
tional erasure of the original invalid block information is prohibited.
怎么写程序识别坏块呢?请看下图。
现在来看看FMD驱动中的flash检测坏块函数
其实还有一个标记坏块函数,这个函数就是在检测坏块的位置标记为非0xff即可,一般是0x00在这里不再赘述。
这几检测坏块函数是被另外一个直接和FAL联系的坏块调用的,那个函数太牛B,所以也要贴出来。
读MBR等都是在这里实现的,这个函数相当关键,盘符能否出现,以及是否检测过度都要看这个函数
对了,flash是如何擦除的呢?这个是以block为单位的。下面来看看
对于这个命令发送原理,请看下图
这个就是针对页的时候,为什么先发列地址一次,然后发三次Row Address(page Address)了
现在真要仔细品味flash的原理了。
其实flash的难点在于ECC,明天再看FMD_WriteSector和FMD_ReadSector两个函数了。不过在下班之前
我要提示一下,这个优龙的bootloader flash的写法貌似有很大不同。到时候再来个比较吧。
————————————————————————————————————————
关于flash结构与编程的文档我已经上传到 CSDN
建议大家下来看看。
——FMD_WriteSector和FMD_ReadSector两个函数涉及的东西较多,我下篇文档会独立分析。
转载请标明:作者.桂林电子科技大学一系科协。如有错误,希望能够留言指出;如果你有更加好的方法,也请在博客后面留言,我会感激你的批评和分享。