LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI write 16 bit

Hi,

 

I am using the I2C&SPI API to implement a SPI master on sbRIO-9637. Sending 8-bit is already working, but I´m still struggling with sending 16-bit. How can this be done without changing CS to high inbetween? The SPI Protocol Input Data is U8.

Any advice is appreciated.

 

Regards,

GM_1

0 Kudos
Message 1 of 15
(4,417 Views)

Hi,

I have exactly the same problem:

If i begin to send a frame with more than one byte ( I tried with 7 bytes) it works fine

But if I begin by sending one byte and after reconfiguring Port to send 7 byte it only send one byte

In fact it seems that reconfiguring Port is not taken into account as if it was locked by something

 

If somebody has an idea to solve this issue it would be appreciated

Best regards

Thierry

0 Kudos
Message 2 of 15
(4,258 Views)

Hi Thierry-91,

 

you need to "Write" the amount of bytes before you "Arm". Don´t reconfigure between writing Data. 

 

Configure -> Write -> Arm -> Read

 

Best regards

GM_1

0 Kudos
Message 3 of 15
(4,245 Views)

Hi GM_1,

 

Thanks a lot for your answer, there is a great improvement, but it is not yet perfect:

I want to send 2 bytes followed by 7 bytes with CS going up between the 2 sequences

So I input (2+7)x8=72 for the number of bits with the following sequence:

 

Configure -->Write 2 bytes--> Arm -->Read 2 bytes-->Write 7 bytes-->Arm-->Read 7 bytes

and my problem is that I obtain the right sequence of 9 bytes but without reseting CS between the two sequences

 

Do I make something wrong?

Thanks in advance for your inputs

 

Best regards

Thierry

0 Kudos
Message 4 of 15
(4,233 Views)

Hi Thierry-91,

 

maybe you can try to configure the SPI-Interface twice:

Configure (NoB=16) -> Write -> Arm -> Read -> Configure (NoB=56) -> Write -> Arm -> Read

 

Best regards

GM_1

 

0 Kudos
Message 5 of 15
(4,214 Views)

Hi GM_1

 

If I do this :

Configure (NoB=16) -> Write -> Arm -> Read -> Configure (NoB=56) -> Write -> Arm -> Read

I reset CS between the two sequence (Which is good !) but the second sequence is only 2 bytes long (Instead of 7)...

 

Life is not easy...

Best regards

Thierry

0 Kudos
Message 6 of 15
(4,204 Views)

Hi Thierry-91,

 

this sounds strange. Is there enough data for the second sequence? (U8-Array with size 7)

Let me know if you could solve it.

 

Best regards,

GM_1

0 Kudos
Message 7 of 15
(4,202 Views)

I have the right number of bytes

It seems that only the first configure is taken into account

I found something related to this problem on comments about this API, somebody is writing:

" It is only possible to configure the SPI port once. After that, any further attempt to configure the port will cause a timeout error."

The answer is :

"Clarification - it is possible to reconfigure the SPI port, but you must do a read/write operation first in order to unlock the configuration."

I do not understand what this means, because I do a write and read operation before the second configuration and this has no effect...

 

Regards

Thierry

 

0 Kudos
Message 8 of 15
(4,197 Views)

wrote:

I found something related to this problem on comments about this API, somebody is writing:

" It is only possible to configure the SPI port once. After that, any further attempt to configure the port will cause a timeout error."

The answer is :

"Clarification - it is possible to reconfigure the SPI port, but you must do a read/write operation first in order to unlock the configuration."

I do not understand what this means, because I do a write and read operation before the second configuration and this has no effect...


I wrote the quoted bits here. Specifically the issue is that if you do a Configure, then another Configure without any read or write, the second Configure will time out. After executing Configure, the configuration gets locked, and it does not get unlocked until after an Arm.

0 Kudos
Message 9 of 15
(4,182 Views)

Hi Nathand,

Thank you for the clarification. anyway it doesn't change my issue:

I reconfigure the SPI port after reading/write/arm, (I only change the nbr of bytes to tranfer and this is not taken into account; I can only transfer the number of bytes specified on the first configuration...

 

Have you an idea of the reason of this?

Thanks in advance

 

Best regards

Thierry

 

 

0 Kudos
Message 10 of 15
(4,173 Views)