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?

1,540件の閲覧回数
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 返答(返信)

1,366件の閲覧回数
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 件の賞賛
返信

1,366件の閲覧回数
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 件の賞賛
返信

1,366件の閲覧回数
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 件の賞賛
返信