第一件事: read chip id. follow datasheet, Command Sets. ReadID 是 1 cycle command, command code = 0x90.
根據 data sheet,第一個id 是maker code,samsung 的maker code = 0xEC;
rNFCONT &= ~(1 << 1); // FCE low : enable
rNFCMD = 0x90; // cmd : readid
rNFADDR = 0x00; // address,
while(!(rNFSTAT & (1 <<2))); // wait chip ok.
ID_byte1 = *(volatile unsigned char*)0x4E000010; //Maker Code
lD_byte2 = *(volatile unsigned char*)0x4E000010; //Device Code
ID_byte3 = *(volatile unsigned char*)0x4E000010; // 3rd data
ID_byte4 = *(volatile unsigned char*)0x4E000010; // 4th data
ID_byte5 = *(volatile unsigned char*)0x4E000010; // 5th data
rNFCONT |= 1 << 1;
第二個是device code,每個chip 不一樣。
3.4.5 可以用來得知該nandflash 的各項property (sector size, block size, chip number,, mlc, slc,,, etc)。
以K9WAG08U1A來看,各ID byte依序是..
- EC
- D3
- 51
- 95
- 58
由id data取得chip property:
InternalChipNumber = 1 << ( iddata[2] & 0x03);
PageSize = 1 << ( iddata[3] & 0x03); // unit : K
BlockSize = 64 * ( 1 << ((iddata[3]>>4) & 0x03)); // unit : K
1 則留言:
我的PDA原本是使用K9F1G的nandflash,如果要換成K9F2G、K9F4G、K9F8G的,那要如何改device code?
張貼留言