K64 SPI - what are the function to read and write single byte or short?

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

K64 SPI - what are the function to read and write single byte or short?

979 Views
eliar
Contributor II

Hi

 

In the SPI demo for k64 there are examples that show how to transfer block of data from master to slave.

 

but suppose i have an external hardware that connect to k64 as a SPI slave device.

this device can be any kind of device that's its interface has SPI where we need to write and read single register

they can be byte or short.

 

So what are the single atomic functions to read and write for the master

 

are they?

 

DSP_ReadData     for reading

and 

DSPI_MasterWriteCommandDataBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, data);

for writing?

 

Thanks!

Labels (1)
0 Kudos
Reply
3 Replies

805 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Eli,

The function of  "DSPI_MasterTransferNonBlocking()" can used as both receive and send .

The butter and size is configured in a structure like the demo :

pastedImage_1.png

If you want send one byte ,  set the dataSize to 1 : slaveXfer.dataSize =1;

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

805 Views
eliar
Contributor II

Hi

And if want just writing and then reading?

Should I set it to zero read?

Can I use function just for read and write?

And not the API that do transfer?

Eli

0 Kudos
Reply

805 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Eli,

I checked the code of "DSPI_ReadData" and "DSPI_MasterWriteCommandDataBlocking" ,

 i think yes , you can use it to read and write .

BR

Alice

0 Kudos
Reply