cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Read the Byte from EEPROM m9564

Erambabu
Visitor

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 >> 8) & 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 >> 8) & 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);

}

 

 

0 REPLIES 0