spi reading a byte problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

spi reading a byte problem

1,222件の閲覧回数
harshadgami
Contributor I

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

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

1,055件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,055件の閲覧回数
harshadgami
Contributor I

1.png2.png3.png4.png5.png

0 件の賞賛
返信

1,055件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信