0
\$\begingroup\$

When receiving data via SPI communication, is there any constraints for word length (bit size)?

I have a chip that sends 16 bits of data A and 16 bits of data B through a single pin, can I configure myRIO to receive those data without any loss?

I'm wondering if myRIO has its own SPI word length limit, because in the LabVIEW example that I found (NI SPI IP) is set as 24 bits.

\$\endgroup\$
1
  • \$\begingroup\$ SPI is not a format or a protocol. It's a hardware connection. So the answer (about byte or word length and so on) depends on how the devices are programmed. \$\endgroup\$
    – Fredled
    Feb 18 at 8:56

1 Answer 1

1
\$\begingroup\$

The closest thing to a standard that defines SPI is this (formerly Motorola) document.

There's no inherent limit in SPI as to word length. Framing is via the /SS (usually called /CS) line-- the master drives it and the slave listens. If you pull /CS low and send the slave x clock edges, you'll get x bits of data at the input provided the slave has them to send (you'll actually get x bits of data clocked in even if the slave doesn't have them- they may be nonsense- whatever is on the MISO line is sampled) and provided you meet the phase and timing relationships defined in the slave chip datasheet. In general each chip can be different. Certainly in maximum clock frequency and timing, and there are four possible clock and data phase relationships.

As to whether the particular NI device you have (myRIO) can support the particular chip you have in the hardware they supply, and under the layers of software (.vi) and how you use that hardware and software, that's more of an NI forums question, but this forum thread has a link to some code (and some confused questions).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.