spi writeread function

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

spi writeread function

1,162 Views
cerr
Contributor I

Hello there,

I'm looking to hook up a p1020 to a Kinetis K60 over SPI. Now, on the P1020, I'm running VxWorks and I have a function spiWriteReadCmd () whixch allows me to send data from an argument provided and at the same time, it will copy the datra in the incoming buffer into an other argument provided.

Now, I'm looking for a similar function on my Kinetis part but have not been able to find it. I have tried around quite a bit already but have not been able to get the SPI on my K60 going yet. I coudln't find much SPI examples for Kinetis, how do I get this going the best?

Labels (1)
Tags (2)
5 Replies

702 Views
cerr
Contributor I

Thanks everyone for the replys!

We got it working now! :smileyhappy:

0 Kudos

702 Views
Amit_Kumar1
Senior Contributor II

Hi Ron

Can you share your writeread function ? Thanks in advance

Kind Regards

Amit Kumar

0 Kudos

702 Views
chandrasekarkan
Contributor III

Hello

    If you are using MQX on K60, try the spi example in "installDirectory/freescale_MQX/mqx/examples/spi".......

rw.BUFFER_LENGTH = 10;
rw.WRITE_BUFFER = (char_ptr)send_buffer;
rw.READ_BUFFER = (char_ptr)recv_buffer;
printf ("IO_IOCTL_SPI_READ_WRITE ... ");
if (SPI_OK == ioctl (spifd, IO_IOCTL_SPI_READ_WRITE, &rw))

This ioctl call, writes commands to spi as well as reads its response....

702 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

There is a SPI demo code for TWR-K60D100M board communication with TWR-MEM Serial Flash device.

Customer can download KINETIS512_V2_SC (Kinetis 100MHz Rev 2 Example Projects) [spi_demo] from below link:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K60_100&nodeId=01624698C9DE2DDDAF&fps...

Wish it helps.

0 Kudos

702 Views
Paul_Tian
NXP Employee
NXP Employee

Hi, Ron

Do you need sample code for bare board or a RTOS? If first one, I can provide one for you.

Best Regards

Paul

0 Kudos