SPI on M52259DEMO board requires MQX kernel rebuild?

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI on M52259DEMO board requires MQX kernel rebuild?

516 Views
MPotts
Contributor III

I am trying to run the MQX SPI example on an M52259DEMO board under MQX 3.6 and get the following error when I try to build:

 

"This application requires BSPCFG_ENABLE_SPI0 defined non-zero in user_config.h. Please recompile kernel with this option."

 

Is this true and if so how do I go about rebuilding the kernel without destroying my setup? Where is user_config.h?

 

Thanks,

Mark

Labels (1)
0 Kudos
4 Replies

253 Views
MPotts
Contributor III

There is no SPI device on the M52259DEMO board, so not surprising it always returns 0x00! Best I switch to my own board which has SPI :smileywink:

0 Kudos

253 Views
MPotts
Contributor III

I figured out how to rebuild MQX with SPI enabled and I was able to build, download and run the sample, however it seems to read only 0x00 from SPI. To be honest I'm not sure what it is reading so perhaps there is no SPI device on the M52259DEMO board. The program output is hown below. Any thoughts or suggestions welcome.

 

Thanks,

Mark


-------------- Polled SPI memory example --------------

Current baud rate ... 1000000 Hz
Changing the baud rate to 500000 Hz ... OK
Current baud rate ... 500000 Hz
Setting clock mode to 0 ... OK
Getting clock mode ... 0
Setting endian to 1 ... OK
Getting endian ... 1
Setting transfer mode to 0 ... OK
Getting transfer mode ... 0
Clearing statistics ... OK
Getting statistics:
Interrupts:   0
Rx packets:   0
Rx overflow:  0
Tx packets:   0
Tx aborts :   0
Tx underflow: 0

Read memory status ... 0xff
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 to location 0x000000f0 in memory ... 0xba
Read memory status ... 0x00
Read byte from location 0x000000f0 in memory ... 0x00
Byte test ... ERROR
Getting statistics:
Interrupts:   0
Rx packets:   8
Rx overflow:  0
Tx packets:   23
Tx aborts :   0
Tx underflow: 0

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 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Read : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Simultaneous read/write (data == 0x00) ... ERROR

0 Kudos

253 Views
ayanavincent
Contributor I

Hi Mark,

I did spi driver program in freescale K60 board and I got the output.

-------------- 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 ... 10000000 Hz

Changing the baud rate to 500000 Hz ... OK

Current baud rate ... 468750 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

Enable device ...

Getting transfer mode ... SPI_DEVICE_MASTER_MODE

Clearing statistics ... not available, define BSPCFG_ENABLE_SPI_STATS

Getting statistics: not available, define BSPCFG_ENABLE_SPI_STATS

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 ... 0x02

Write unprotect memory ... 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: not available, define BSPCFG_ENABLE_SPI_STATS

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:

ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890

Write long data test ... OK

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 0xff 0xba 0xff 0xff 0xff 0xff 0xff

Simultaneous read/write (data == 0xba) ... OK

0 Kudos

253 Views
ayanavincent
Contributor I

Hi Mark,

I did spi driver program in freescale K60 board and I got the output.

-------------- 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 ... 10000000 Hz

Changing the baud rate to 500000 Hz ... OK

Current baud rate ... 468750 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

Enable device ...

Getting transfer mode ... SPI_DEVICE_MASTER_MODE

Clearing statistics ... not available, define BSPCFG_ENABLE_SPI_STATS

Getting statistics: not available, define BSPCFG_ENABLE_SPI_STATS

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 ... 0x02

Write unprotect memory ... 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: not available, define BSPCFG_ENABLE_SPI_STATS

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:

ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890

Write long data test ... OK

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 0xff 0xba 0xff 0xff 0xff 0xff 0xff

Simultaneous read/write (data == 0xba) ... OK

0 Kudos