Hello Everyone,
I am working with an MSP430F5638 and trying to interface with a 2G Micron NAND Flash chip. I am able to successfully read the device ID and the parameters, however, I am not able to successfully write to the flash chip. I am also able to read from the flash chip, I know this because when I read from the chip I get 0xFF, which is the default state for this NAND flash chip. I think there are two reasons for this, the first is I am confused on the address structure. I have looked at various application notes and I think I have an idea, but it is very confusing. The first byte out of five transmitted is the LSB of the address, which corresponds to the LSB of the Byte address in the Page. Then comes more of the byte-in-page, then page address with two bits of the block address and the remaining bytes/bits are the actual block/plane (I hope that makes sense). I suspect my second issue is some problem with my code, but I am not sure what. I have looked at all of the pins on an oscilliscope, and everything seems to be lining up.
I have posted my header file, driver code and main code below. I would appreciate any help you guys can give me on why I can't seem to write to the flash!
//----------------------------------------------------------------------------//
// FUNCTION NAME: NAND_ProgData
//
// INPUTS: col1, col2 - Column address bytes
// row1 - row3 - Row address bytes
// Size - Length in bytes to be written to flash
// dataIn - Array of data to be written to flash
//
// OUTPUTS: None
//
// FUNCTIONALITY: Send data in dataIn array to flash at given memory address
//----------------------------------------------------------------------------//
unsigned char NAND_ProgData(unsigned char col1,unsigned char col2,unsigned char
row1,unsigned char row2,unsigned char row3,uint16_t
Size,unsigned char *dataIn)
{
uint16_t i;
unsigned char status[1];
NAND_WriteCommand(0x80,false);
NAND_WriteAddress(col1,col2,row1,row2,row3);
__delay_cycles(2);
for(i=0;i<Size;i++)
{
NAND_WriteByte(dataIn[i]);
}
NAND_WriteCommand(0x00,false);
while((P1IN&RB) == 0){}
NAND_WriteCommand(0x70,false);
NAND_ReadBytes(1,status);
CE_ON;
return(status[0]);
}
**********************************Relevant Main Function********************************************
for(i=0;i<255;i++)
{
flashOut[i] = 0xAA;
}
flashOut[255] = 0x2C;
NAND_ProgEnable();
temp = NAND_ProgData(0x00,0x00,0x00,0x00,0x00,256,flashOut);
NAND_ReadData(0x00,0x00,0x00,0x00,0x00,256,flashIn);
while(1)
{
}