DOC: SPII2CHDWBrief - V2.71 07/25/2017
PAGE 21
USING SPI
Electrical Data Connection and Addressing
Enabling the SPI/I2C interface is controlled by Pin 2 (SPI/I2C Enable). Applying power to Pin 2
(from pin 6) disables USB connectivity and enables the SPI/I2C interface. Choosing SPI or I2C for a
LB5900 sensor is done using Pin 1 of the interface cable. Grounding the pin will enable SPI and
disable I2C, applying power (from Pin 6), selects I2C and disables SPI.
Data direction. To simplify connectivity, LadyBug utilizes the MOSI/MISO naming scheme. This
allows the pins on the master and the slave to have the same name. For example, the output of
the master must always be connected to the input of the slave. This line is called MOSI,
M
aster
O
ut
S
lave
I
n. The master’s input is MISO,
M
aster
I
n
S
lave
O
ut. Some microcontroller
manufacturers may not use this terminology, however the SPI connections function the same.
SPI sensors require a separate Slave Selection (SS) connection for each sensor used. For example
if two sensors are used, SCLK, MOSI and MISO are all connected to each sensor and the
microcontroller. The microcontroller must also have two SS outputs, one to select each sensor.
Only one SS line may be active at any given time, the non-active line disables the sensor’s MISO
(the sensor’s data output line in this case) line. The SS line is active low as shown in Figure 17.
Figure 17 - Typical SPI connection