cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Read the Byte from EEPROM m9564

Erambabu
Associate

Edited the post to follow the community guidelines. In next time please use </> button to paste your code. See this post.

Hello Experts,

I  am unable to read the byte of data from eeprom in particular address after written the data.
i am getting the response from eeprom through miso line while reading the status register and i have checked again by changing the status register values. I am using tc397 as master.

this is my code:

void EEPROM_Write_Byte(uint16 address,uint8 data)

{

EEPROM_Write_Enable();

uint8 txdata[4] = {0x02, (address >> ‌‌ & 0XFF, address & 0xFF, data}; /* WRITE command, MSB address, LSB address, one byte Data */

IfxQspi_SpiMaster_exchange(&g_qspi.spiMasterChannel,txdata,NULL,4);

Wait_UntilReady(); /* wait for write operation completion*/

waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, 200)); /* Time Delay for 10 milli seconds */

}



void EEPROM_Write_Enable()

{

uint8 command = 0x06;

IfxQspi_SpiMaster_exchange(&g_qspi.spiMasterChannel, &command, NULL_PTR,1);

waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, 30)); /* Time Delay for 10 milli seconds */

}

uint8 EEPROM_Readstatus(void)

{

uint8 txdata[2] = {0x05,0x00};

uint8 rxdata[2]={0};

IfxQspi_SpiMaster_exchange(&g_qspi.spiMasterChannel, txdata, rxdata, 2);

return rxdata[1];

}



void Wait_UntilReady(void)

{

while(EEPROM_Readstatus() & 0x01); /* Checking write in progress bit */

}

void EEPROM_Read_Byte(uint16 address)

{

uint8 cmd[3] = {0x03, (address >> ‌‌ & 0xFF, address & 0xFF}; /* READ command, MSB address, LSB address*/

uint8 rx_data[3] = {0};

IfxQspi_SpiMaster_exchange(&g_qspi.spiMasterChannel,cmd,rx_data,3);

//IfxQspi_SpiMaster_exchange(&g_qspi.spiMasterChannel,NULL,&rxdata,1);

}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

Welcome @Erambabu, to the community!

You asked this question some time ago, but if it's still relevant: there is no M9564, which EEPROM are you using exactly?

If you mean the M95640, that is a normal SPI EEPROM that you want to address as QSPI, which of course cannot work.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Peter BENSCH
ST Employee

Welcome @Erambabu, to the community!

You asked this question some time ago, but if it's still relevant: there is no M9564, which EEPROM are you using exactly?

If you mean the M95640, that is a normal SPI EEPROM that you want to address as QSPI, which of course cannot work.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.