AnsweredAssumed Answered

Unknown error in spi example

Question asked by Yadhukrishnan V M on Sep 26, 2016
Latest reply on Sep 28, 2016 by Daniel Chen

Hi,

I am working with my K60N512 custom board. Now I am trying to create output for spi example in mqx folder.I found read error like below

 


-------------- 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.
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 ... 0x00
Write unprotect memory ... OK
Enable write latch in memory ... OK
Read memory status ... 0x00
Write unprotect memory ... OK
Enable write latch in memory ... OK
Read memory status ... 0x00
Erase whole memory chip:
Read memory status ... 0x00
Erase chip ... OK

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

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


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

 

 

I have asked this 2 times in nxp community nobody answered my questions.

I found strange thing which is like a bug in KDS. In the spi example there is a part of code to define the memory channel:

 

#if BSP_SPI_MEMORY_CHANNEL == 0

#if ! BSPCFG_ENABLE_SPI0
#error This application requires BSPCFG_ENABLE_SPI0 defined non-zero in user_config.h. Please recompile kernel with this option.
#else
#define TEST_CHANNEL "spi0:"
#endif

#elif BSP_SPI_MEMORY_CHANNEL == 1

#if ! BSPCFG_ENABLE_SPI1
#error This application requires BSPCFG_ENABLE_SPI1 defined non-zero in user_config.h. Please recompile kernel with this option.
#else
#define TEST_CHANNEL "spi1:"
#endif

#elif BSP_SPI_MEMORY_CHANNEL == 2

#if ! BSPCFG_ENABLE_SPI2
#error This application requires BSPCFG_ENABLE_SPI2 defined non-zero in user_config.h. Please recompile kernel with this option.
#else
#define TEST_CHANNEL "spi2:"
#endif

 

I have defined the macro  #define BSP_SPI_MEMORY_CHANNEL              (1)   in the <board>.h file but look at this screen shot. When I right click on SPI_MEMORY_CHANNEL and click on explore declaratio I found this. That is the macro defined for memory channel two.But I have defined it as 1 in bsp files why is this happening please help... 

Outcomes