TMS320C6748: Read/Write NAND Flash Memory Problems
Started by 7 years ago●4 replies●latest reply 7 years ago●263 viewsHello,
I have a board based on TMS320C6748. I am trying to read/write from/to ROM memory space. I could access to other memories (internal memory and even NOR FLASH). but haven't had any success to access NAND FLASH. anything I wrote and then read, I get 0xFF 0xFF 0xFF .....
Actually GPIO pin chip select being connected to the FLASH Chip select signal. Actually /CE not connected.In this case /CE5 not connected any where. Then i have taken /CE5 address is assigned to FLASH, Because it is connected to GPIO pin. How to Write and READ.
Now i am taken /CE5 address is assigned to NAND_CSn(GPIO7[13]).
/CE5 Address(flash_addr=0x66000000) is assigned to NAND FLASH.
void test_flash(void)
{
uint8_t flash_err_flag,data2send;
data2send = 0x00;
UART_txString(DEBUG_PORT,"\n\rEnter Block Number to be Tested");
block_no=get_block_no();
if(block_no >= 2048)
{
UART_txString(DEBUG_PORT,"\n\rInvalid Block Number");
return;
}
flash_block = 0x00000000;
flash_blockH = (block_no >> 9) & 0x03 ;
flash_block = flash_block | (block_no << 23);
UART_txString(DEBUG_PORT,"\n\rERASING BLOCK");
nandFlashBlockErase(flash_block);
UART_txString(DEBUG_PORT,"\n\rBLOCK ERASED");
for(i=0;i<2048;i++)
Buffer[i] = data2send;
page_no=0;
temp_block = flash_block ;
UART_txString(DEBUG_PORT,"\n\rWRITING DATA TO BLOCK...");
while(page_no<1)
{
flash_block = flash_block & 0xFF800000 ;
flash_block = flash_block | (page_no << 16);
nandFlashPageWrite(flash_block);
page_no++;
}
UART_txString(DEBUG_PORT,"\n\rDATA STORED IN FLASH");
for(i=0;i<2048;i++)
Buffer[i] = 0;
UART_txString(DEBUG_PORT,"\n\rVERIFYING DATA...");
page_no = 0;
flash_block=temp_block;
while(page_no<1)
{
flash_block = flash_block & 0xFF800000 ;
flash_block = flash_block | (page_no << 16);
nandFlashPageRead(flash_block);
UART_txString(DEBUG_PORT,"\n\rbuffer:\n\r");
for(i=0;i<2048;i++)
{
if(Buffer[i] != data2send )
{
flash_err_flag=1;
UART_txString(DEBUG_PORT,"\n\rFLASH Read test failed");
break;
}
}
page_no++;
}
if(flash_err_flag==1)
{
UART_txString(DEBUG_PORT,"\n\rFLASH test failed");
}
else
{
UART_txString(DEBUG_PORT,"\n\rFLASH test passed");
}
}
uint8_t nandFlashPageWrite( uint32_t NandAddr)
{
uint16_t NandStatus=0;
flash_cmd( NAND_CMD_PAGEPROG_I ); //program command 1st cycle with 80h
flash_address( (uint16_t) ( ( NandAddr) & 0xff) );
flash_address( (uint16_t) ( ( NandAddr >> 8 ) & 0xff) ); //low block address
flash_address( (uint16_t)( (NandAddr >> 16) & 0xff) );//high block address
flash_address( (uint16_t)( (NandAddr >> 24 ) & 0xff) ); //low block address
flash_address( (uint16_t)flash_blockH );//high block address
for ( i = 0; i < 1024; i++ )
*(volatile uint8_t *)flash_addr= Buffer[i] ;
flash_cmd( NAND_CMD_PAGEPROG_II );//confirm program with 10h
//read NAND status register
flash_cmd( NAND_CMD_RD_STATUS );
//wait until write operation success
do
{
NandStatus = *(volatile uint8_t *)flash_addr;
}while(!(NandStatus & 0x40));
flash_cmd( NAND_CMD_RD_DONE );
return NandStatus;
}
Hi,
are you sure that the Flash has been programmed successfully?
0xFF can come from the Flash itself (this is the value you get when the Flash is formatted), but it can be also the floating data bus.
The first thing you should do is to check that there is something inside the Flash that can be read.
If you can read the Flash (you can check it using a preprogrammed Flash containing something you know), then you will be sure that there is an issue with the Flash programming code. Check also if you have not activated the Flash protection by the way.
Hope this can help
Benoit
Hi Benoit,
Already i am able to read the FLASH ID's and SIZE deafult values,But When morethan 50 times Writing means 1 time will read,Number of times i am not able to read,
Thanking You,
Ram
Ram,
Flash chips I've used in the past required setting control registers to set the chip into write/programming mode. I would check the documentation for the chip to see specific programming sequence requirements.
Good Luck,
Bob J.
I am sorry, but I do not understand at all what you mean.