??? 07/05/11 06:43 Modified: 07/05/11 06:59 Read: times |
#182805 - No, SPI does *not* have both commands and data! Responding to: ???'s previous message |
No, it doesn't!
You must be thinking of I2C ? SPI defines only the hardware "interface"[1] - it says nothing about any "protocol"[1] for any meaning of the bits transferred. I2C, on the other hand, defines both a hardware "interface" - and a "protocol" for addressing (including read/write direction), acknowledging, and encapsulating messages. See: http://www.byteparadigm.com/kb/articl...ocols.html Richard Erlacher said:
I haven't used it in several years, but it seems to me there IS an overlying protocol. So you've been mistaken for all those years! you have to tell the device what to do. Of course, specific devices will define their own "protocol" for the meaning of the bits transferred over their SPI connection, but this is specific to the particular slave implementation - it is nothing specifically to do with SPI itself. While it may be possible to make some SPI masters drive some ttl-lookalike SIPO registers, it's not likely you'll make it work with all of them. That may be true - but it's a limitation of the Master implementation - not inherent in SPI itself. you have to tell the slave whether it's receiving data from the master or transmitting it. No - not at all! That's why there are separate MOSI amd MISO lines! MOSI = Master Output, Slave Input; MISO = Master Input, Slave Output. So the direction of the data is known implicitly from which line it's on! That's done by means of a command. A specific slave may define its own protocol to work that way - but it is not inherent in SPI itself. You also have to tell it something about the clock data relationship No - the Slave defines that in its datasheet; the Master has to be "told" (ie, configured appropriately). An advantage of SPI (and big difference from I2C) is precisely that it defines none of these things - giving you complete freedom to use it however you like! As the Wikipedia article that you cited says, Wikipedia said:
Advantages
: : * Complete protocol flexibility for the bits transferred + Not limited to 8-bit words + Arbitrary choice of message size, content, and purpose : : http://en.wikipedia.org/wiki/Seri...Advantages Did you actually read that article? ---------- [1] I'm just using the terms "interface" and "protocol" loosely here for the purposes of this specific argument - I'm not trying to make any claim that they should have specific, distinct meanings in general. The hardware "interface" could equally be called the hardware "protocol" or Layer-0 "protocol", or whatever. Don't get hung-up on this. |