SPI serial memory test addresses write failure?

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

SPI serial memory test addresses write failure?

1,646 Views
mehdikarimibiuk
Contributor V

Hi,

I have created and MQX 4.0 project with the simple example SPI project that is available in the CodeWarrior 10.5

My kit is TWR-K60D100M with Kinetis MK60DN512 VMD10.

In "main.c", there is a section for serial memory addresses:

/* The SPI serial memory test addresses */

#define SPI_MEMORY_ADDR1               0x0000F0 /* test address 1 */

#define SPI_MEMORY_ADDR2               0x0001F0 /* test address 2 */

#define SPI_MEMORY_ADDR3               0x0002F0 /* test address 3 */

...Can you tell me if these are correct memory addresses?

The reason for asking is, when I write to those memory addresses, I receive error:

Enable write latch in memory ... OK

Read memory status ... 0x00

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

Read memory status ... 0x00

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

Byte test ... ERROR

Getting statistics:

Rx packets: 8

Tx packets: 25

Enable write latch in memory ... OK

Read memory status ... 0x00

Page write 12 bytes to location 0x000001f0 in memory:

Hello,World!

Read memory status ... 0x00

Reading 12 bytes from location 0x000001f0 in memory:

Write short data test ... ERROR

Enable write latch in memory ... OK

Read memory status ... 0x00

Page write 16 bytes to location 0x000002f0 in memory:

ABCDEFGHIJKLMNOP

Enable write latch in memory ... OK

Read memory status ... 0x00

Page write 56 bytes to location 0x00000300 in memory:

QRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890

Read memory status ... 0x00

Reading 72 bytes from location 0x000002f0 in memory:

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 : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

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

--------------------

Project attached.

------------------

Notes:

I built it with Freescale compiler not GCC.

My kit is TWR-K60D100M with Kinetis MK60DN512 VMD10.

My MQX: MQX 4.0 with CW: 10.5.

Added "#define BSPCFG_ENABLE_SPI_STATS 1" in "user_config.h" and rebuilt bsp/psp.

Original Attachment has been moved to: my_spi.zip

0 Kudos
4 Replies

654 Views
Symbolic
Contributor III

Hi Mehdi,

This may be a silly question, but is there an SPI memory chip on the SPI bus?

The TWR-K60D100M does not have a SPI memory chip on it, and you would have to interface to such a chip - using a custom circuit, or possibly the tower memory board.

What the example is attempting to do is to read and write data to an external memory chip on the SPI bus, and those addresses are just arbitrary addresses on that external chip.

Due to the nature of SPI, it may appear that writes and reads to a (non-existent) chip are working, as the SPI bus will always clock the data out and in (nothing to tell the bus itself if a chip is really responding)

However, write data is just being discarded (nobody on the other end of the telephone line is listening) and read data will probably be either all 1's or all 0's as nobody is feeding intelligent data back, and the state of the circuit will determine if it is high (you get all 1's) or low (you get all 0's)

0 Kudos

654 Views
mehdikarimibiuk
Contributor V

Hi Stephen,

Yes you are right, you need to buy that extra memory card for the tower.

But I have a better idea, instead of using memory. use spi loopback. Simply do a loopback between two spi's and if you want to test your functions make one as master and the other slave.

0 Kudos

654 Views
JULIOOSVALDOANG
Contributor I

Hi Stephen

I have same isssue

I'm using the tower k53 board, I added

#define BSPCFG_ENABLE_SPI_STATS 1

to user_config.h

The Tower K53 has SD card socket, I enabled J10 to connect SD card to SPI

signals

Could you suggest me how to proceed?

Thanks

Julio

0 Kudos

654 Views
mehdikarimibiuk
Contributor V

Hi Julio,

Just a comment that may help with your spi functions. If you are to try SPI functionality you may just want to have a loopback between two spi modules. I have not tried your approach so I cannot comment on that.

0 Kudos