Nand driver development

Nand driver

 

1. 以下是以Samsung某款Nand为例

1 Page = (2K + 64)Bytes

1 Block = (2K + 64)B x 64 Pages = (128K + 4K) Bytes

1 Device = (2K+64)B x 64Pages x 4,096 Blocks= 4,224 Mbits =512MB

以前的SmallPage的通常

1Page = (512 + 16)Bytes

1Block = (512 + 16) * 64Pages = 32K + 1K

 

地址通常先两个Column地址(A0-A11), 后三个Row地址(A12-A29)

 

Write&Read是以Page为单位的, Erase是以Block为单位的, 通常Write之前要Erase

 

 

2. Pin定义

I/O0-I/O7 数据

CLE Command Latch Enable

ALE Address Latch Enable

CE Chip Enable(Low activated)

RE Read Enable (Low activated)

WE Read Enable(Low activated)

WP Write Protected(Low actived)

R/B Ready/Busy

VCC Power

VSS Ground

 

3. 命令集

 

 

4.基本函数

  通常会有三个地址:

  读数据的地址READ_DATA

  写地址的地址WRITE_ADDR

  写数据/命令的地址WRITE_COM

 

4.1 ID detection

 

   WriteCommand(0x90);   //output to WRITE_COM

   WriteAddr(0x0);       //output to WRITE_ADDR

 

   ManufacturerID=ReadOneByte();  //0xEC Samsung, 0x20 ST

   DeviceID=ReadOneByte();  

 

4.2 Reset

    WriteCommand(0xFF)

 

4.3 ReadOnePage

    WriteCommand(0x00);

    WriteAddr(Column地址的低8, A0-A7);

    WriteAddr(Column地址的高4, A8-A11);

    WriteAddr(Row地址的低8, A12-A19);

    WriteAddr(Row地址的中间8, A20-A27);

    WriteAddr(Row地址的高2, A28-A29);

    WriteCommand(0x30);

 

    Reset HW ECC, Read 512Bytes, Get HW ECC (loop 4 times)

 

    Read Spare data

   

    Compare ECC, Correct ECC if needed

 

4.4. WriteOnePage

    WriteCommand(0x80);

    WriteAddr(Column地址的低8, A0-A7);

    WriteAddr(Column地址的高4, A8-A11);

    WriteAddr(Row地址的低8, A12-A19);

    WriteAddr(Row地址的中间8, A20-A27);

    WriteAddr(Row地址的高2, A28-A29);

 

    Reset HW ECC, Write 512 Bytes, Get HW ECC (loop 4 times)

    Write ECC data to spare area

 

    WriteCommand(0x30);

 

 

4.5 EraseOneBlock

    WriteCommand(0x60);

    WriteAddr(Row地址的低8, A12-A19);

    WriteAddr(Row地址的中间8, A20-A27);

    WriteAddr(Row地址的高2, A28-A29);

    WriteCommand(0xD0);

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值