![]() ![]() Depending on the phase (covered in detail just below) both chips may also set up their first bit of output. The master pulls the slave’s personal slave-select line low, at which point the slave wakes up, starts listening, and connects to the MISO line.Note that the master is responsible for keeping one and only one SS line active low at any given time. When the individual SS line is pulled low, the slave engages. That is, each slave has a slave-select (SS or sometimes called chip-select CS) line, and when it’s high, the slave disconnects its MISO line, and ignores what comes in over MOSI. Since all of the rings are shared, each slave has an additional dedicated line that tells it when to attach and detach from the bus. Instead of a simple ring as drawn above, the master’s shift register is effectively in a ring with each of the slave devices, and the lines making up this ring are labelled MISO (“master-in, slave-out”) and MOSI (“master-out, slave-in”) depending on the direction of data flow. The master controls the clock (CLK or SCK) line, that’s shared among all of the devices on the bus. Turning this pair of shift registers into a full-blown data bus involves a couple more wires, so let’s look into that now, and cover the labelling of these wires as we go. But between machine and machine, it’s going to be SPI or I2C (and that’s the next article). You often see asynchronous serial between man and machine, because people are fairly slow. While asynchronous serial communications can run in the hundred-of-thousands of bits per second, SPI is usually good for ten megabits per second or more. It’s this simplicity that makes SPI fast. ![]() One device, the master, controls the common clock signal that makes sure that each register shifts one bit in just exactly as the other is shifting one bit out (and vice-versa). These two shift registers are connected together in a ring, the output of one going to the input of the other and vice-versa. The core idea of SPI is that each device has a shift-register that it can use to send or receive a byte of data. Now that you’ve got that working, it’s time to step up to debugging your SPI bus! After a brief overview of the system, we’ll get into how to diagnose SPI, and how to fix it. In the previous article in this series, inspired by actual reader questions, I looked into troubleshooting asynchronous serial connections. Even despite SPI’s simplicity, there are still a few ways that things can go wrong. But that doesn’t mean that everything is hugs and daffodils. It’s the bare-minimum way to transfer a lot of data between two chips as quickly as possible, and for that reason alone, it’s one of my favorites. Serial Peripheral Interface (SPI) is not really a protocol, but more of a general idea. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |