Skip to content

Commit 8787a6d

Browse files
committed
docs: Fix list.
1 parent 4c151e0 commit 8787a6d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/programming_guide/03_i2c_spi.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ SPI Devices
112112
The SPI protocol, or `serial peripheral interface <https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus>`_, is another example of a serial protocol for two devices to send and receive data. The big difference between SPI and I2C is that SPI uses a few more wires, in particular an explicit data input and data output wire instead of sharing a single data wire like with I2C. There's also a clock wire like in I2C, but with SPI it has the freedom to use almost any speed it desires from a few kilohertz up to hundreds of megahertz (if the hardware supports it!). This makes the SPI protocol great for devices like TFT displays that need to be sent very large amounts of data--with control over the clock speed it's possible to very quickly send entire screen images to the display.
113113

114114
Compared to I2C the SPI protocol has some interesting properties:
115+
115116
- SPI uses 3 to 4 wires for sending and receiving data. One wire is a clock line that toggles up and down to drive bits being sent and received. Like with I2C only the master device can drive the clock. Another wire is MOSI, or 'master output, slave input' which is the data output from your board and sent to a connected device. Likewise a MISO wire, or 'master input, slave output', is for sending data from the device to the board receiving it. Finally most chips have a CS, or chip select, wire which is toggled to tell the chip that it should listen and respond to requests on the SPI bus.
116117
- Like I2C multiple devices can share the same SPI bus, however a big difference is that each device typically requires its own unique CS line. Remember the CS/chip select line is what tells a chip that it should listen for SPI traffic. As a result for each SPI device you connect to your board it can share the clock, MOSI, MISO lines but must have its own CS line (typically connected to any free digital I/O pin).
117118
- SPI devices have different requirements for speed (sometimes called baudrate), polarity, and phase. The `SPI page on Wikipedia <https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus>`_ has a good description of what polarity and phase mean--they control how the data is sent and received over the MISO and MOSI lines. Different polarity values control if a digital high or low logic level means a bit is a one or zero. Similarly different phase values control when data is read and written by devices--either with the rising or falling edge of the clock line. The important thing to know about phase and polarity is that each device has its own requirement for setting them so be sure to check your device's datasheet. Many devices are 'mode 0' which means a polarity and phase of 0 but watch out because some devices use different modes.

0 commit comments

Comments
 (0)