Flash AT45DB interfaing with KW41z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Flash AT45DB interfaing with KW41z

760 次查看
abhitippanna
Contributor III

Hiii , 

I am using AT45DB041E flash which are available on FRDM-KW41Z evaluation borad ,

Interfacing of AT45DB041E using SPI communication , using this Read Manufacturer ID and Device ID successfully , but for read data it always read FF or 00

unsigned char RdFlashByte(unsigned int BuffAddr)
{
unsigned char rddata = 0 ;
unsigned char t1[5]={0};

PRINTF("\nRdFlashByte\r\n");

while(!FlashReadBusy()); //wait if device is busy

t1[0] = BUFFER_1_READ; //or 0xD1
t1[1] = 0x00;
t1[2] = ((unsigned char)(BuffAddr>>8));
t1[3] = ((unsigned char)(BuffAddr));
t1[4] = 0x00;


isTransferCompleted = false ;

dspi_transfer_t masterXfer;

masterXfer.txData = &t1[0] ;
masterXfer.rxData = NULL ;
masterXfer.dataSize = 5 ;
masterXfer.configFlags = kDSPI_MasterCtar1 | EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER | kDSPI_MasterPcsContinuous;

DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &g_m_handle, &masterXfer);

/* Wait transfer complete */
while (!isTransferCompleted)
{
}

/* Delay to wait slave is ready */
for (i = 0; i < EXAMPLE_DSPI_DEALY_COUNT; i++)
{
__NOP();
}


isTransferCompleted = false ;

masterXfer.txData = NULL ;
masterXfer.rxData = &rddata ;
masterXfer.dataSize = 1 ;
masterXfer.configFlags = kDSPI_MasterCtar1 | EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER | kDSPI_MasterActiveAfterTransfer;

DSPI_MasterTransferNonBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &g_m_handle, &masterXfer);

/* Wait transfer complete */
while (!isTransferCompleted)
{
}

/* Delay to wait slave is ready */
for (i = 0; i < EXAMPLE_DSPI_DEALY_COUNT; i++)
{
__NOP();
}

PRINTF("\n Rx data :%d \r\n,",rddata);

return rddata;

} //End of RdFlashByte Function

please give some idea.

0 项奖励
3 回复数

599 次查看
abhitippanna
Contributor III

No fault or error observed in code , Writing flash page 0 and reading same page but it always read 00 or FF data ...

Any additional setting required to use AT45DB041E flash 

0 项奖励

599 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

As I do not have the same memory as you do, I'm limited to the capabilities of the device and my available resources which are from NXP  and our developments boards. 

How are you confirming that you are reading and writing correctly form the memory? Are you checking the registers with the received data? 

Regards, 

Estephania 

0 项奖励

598 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Are you basing it on an example? If you are, could you please let me know if you are, could you please give me more details about it? 

Also, are you having some kind of fault? Or is it just that it is not reading the correct value? 

Regards, 

Estephania 

0 项奖励