Problem about spi test on custom k60d100m with MQX 4.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem about spi test on custom k60d100m with MQX 4.1

702 Views
jerryzhang
Contributor III

Hi every,

I met a problem in development. I can't read correct data on eeprom via spi. Then I use spi test in MQX 4.1. The result shows that read/write test correct partly. The hardware works right on MQX 3.8.

the following is the screenshot of test:

-------------- SPI driver example --------------

This example application demonstrates usage of SPI driver.

It transfers data to/from external memory over SPI bus.

The default settings in memory.h apply to TWR-MEM flash memory.

Test channel is spi2:

Current baud rate ... 9600000 Hz

Changing the baud rate to 500000 Hz ... OK

Current baud rate ... 500000 Hz

Setting clock mode to SPI_CLK_POL_PHA_MODE0 ... OK

Getting clock mode ... SPI_CLK_POL_PHA_MODE0

Setting endian to SPI_DEVICE_BIG_ENDIAN ... OK

Getting endian ... SPI_DEVICE_BIG_ENDIAN

Setting transfer mode to SPI_DEVICE_MASTER_MODE ... OK

Getting transfer mode ... SPI_DEVICE_MASTER_MODE

Clearing statistics ... OK

Getting statistics:

Rx packets:   0

Tx packets:   0

Read memory status ... 0x00

Enable write latch in memory ... OK

Read memory status ... 0x02

Write unprotect memory ... OK

Enable write latch in memory ... OK

Read memory status ... 0x03

Write unprotect memory ... OK

Enable write latch in memory ... OK

Read memory status ... 0x03

Erase whole memory chip:

Read memory status ... 0x03

Read memory status ... 0x00

Erase chip ... OK

Enable write latch in memory ... OK

Read memory status ... 0x02

Write byte 0xba to location 0x000000f0 in memory ... done

Read memory status ... 0x00

Read byte from location 0x000000f0 in memory ... 0xba

Byte test ... OK

Getting statistics:

Rx packets:   9

Tx packets:   26

Enable write latch in memory ... OK

Read memory status ... 0x02

Page write 12 bytes to location 0x000001f0 in memory:

Hello,World!

Read memory status ... 0x00

Reading 12 bytes from location 0x000001f0 in memory:

Hello,World!

Write short data test ... OK

Enable write latch in memory ... OK

Read memory status ... 0x02

Page write 16 bytes to location 0x000002f0 in memory:

ABCDEFGHIJKLMNOP

Enable write latch in memory ... OK

Read memory status ... 0x02

Page write 56 bytes to location 0x00000300 in memory:

QRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890

Read memory status ... 0x00

Reading 72 bytes from location 0x000002f0 in memory:

QRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

Write long data test ... ERROR

IO_IOCTL_SPI_READ_WRITE ... OK

Simultaneous write and read - memory read from 0x000000f0 (10):

Write: 0x03 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00

Read : 0xff 0xff 0xff 0xf0 0xf0 0xf0 0x00 0x51 0x52 0x53

Simultaneous read/write (data == 0xf0) ... ERROR

-------------- End of example --------------

For long write, it shows that it read 0x000002f0, but the return data is on 0x00000300.

And for simultaneous write, it's totally wrong.


Any suggestion?

Tags (5)
0 Kudos
3 Replies

426 Views
RadekS
NXP Employee
NXP Employee

Memory part of SPI example code was written for AT26DF081A SPI Serial Flash Memory at TWR-MEM board.

According your description it seems that you don’t use this type of memory (Read memory status differs from description in _readme.pdf file).

It is obvious that example stops work when you tried page write with 56 bytes length (Read memory status returns 0x00).

AT26DF081A allows write up to 256 bytes by page write. I suppose that your memory has smaller pages.

Please check your memory specification.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

426 Views
jerryzhang
Contributor III

Thanks Radek.

After test. I modified the page size and got a correct result.

0 Kudos

426 Views
jerryzhang
Contributor III

There is another interesting issue appearing.

My Eeprom device is 25AA512 and its page size is 0x80.

However, if I set SPI_MEMORY_PAGE_SIZE to 80, the result is still wrong. While I set it to 0x120, I got right result on write long data.

0 Kudos