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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

978 次查看
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!

标签 (1)
0 项奖励
回复
3 回复数

804 次查看
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 项奖励
回复

804 次查看
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 项奖励
回复

804 次查看
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 项奖励
回复