Hello,
I am working with TWR-K20D72M board. I interface CAT-25256 EEPROM with this board.
my write data in eeprom is work proper.but reading data was not working.
when i was read data at that time if breakpoint will put then reading was sucessful. if not put breakpoint than data not read proper it gives output 0x00 .
please check my code in attachment.
It would be more appreciable if any kind of suggestions will be get.
Thanks,
Harshad
Original Attachment has been moved to: spi.txt.zip
Hi harshad gami,
Please give me a picture, where the breakpoint you put will read successfully?
It seems your my_delay is not long enough to response your reading, you can add more my_delay() to wait the external EEPROM ready.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi harshad gami,
1. Did you check the communicate SPI wave? Whether the slave return the correct data? You can use the oscilloscope check the SPI wave.
2. check the SPI clock, whether it is in the range of your EEPROM.
3. Use bit SPI_SR[RFDF] to wait the received data, eg
uint8 temp;
while(!(SPI0_SR & SPI_SR_RFDF_MASK)){}
temp= SPI0_POPR;
SPI0_SR |= SPI_SR_RFDF_MASK;
return temp;
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------