AnsweredAssumed Answered

Problem about spi test on custom k60d100m with MQX 4.1

Question asked by Jerry Zhang on Dec 8, 2014
Latest reply on Jan 18, 2015 by Jerry Zhang

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?

Outcomes