
The CPOL bit sets the polarity of the clock signal during the idle state. In SPI, the main can select the clock polarity and clock phase. Please refer to the device data sheet to determine the number of data bits transmitted using the SPI interface. The SPI interface provides the user with flexibility to select the rising or falling edge of the clock to sample and/or shift the data.
SHIFT REGISTER USING SPI ARDUINO SERIAL
The serial clock edge synchronizes the shifting and sampling of the data. During SPI communication, the data is simultaneously transmitted (shifted out serially onto the MOSI/SDO bus) and received (the data on the bus (MISO/SDI) is sampled or read in).

SPI is a full-duplex interface both main and subnode can send data at the same time via the MOSI and MISO lines respectively. To begin SPI communication, the main must send the clock signal and select the subnode by enabling the CS signal. Usually chip select is an active low signal hence, the main must send a logic 0 on this signal to select the subnode. MOSI transmits data from the main to the subnode and MISO transmits data from the subnode to the main. In this article, the chip select signal is always an active low signal.

When multiple subnodes are used, an individual chip select signal for each subnode is required from the main. This is normally an active low signal and is pulled high to disconnect the subnode from the SPI bus. The chip select signal from the main is used to select the subnode. Figure 1 shows the SPI connection between the main and the subnode. SPI interfaces can have only one main and can have one or multiple subnodes. Users should consult the product data sheet for the clock frequency specification of the SPI interface. SPI devices support much higher clock frequencies compared to I 2C interfaces. Data transmitted between the main and the subnode is synchronized to the clock generated by the main. The device that generates the clock signal is called the main. SPI configuration with main and a subnode. This article focuses on the popular 4-wire SPI interface. The SPI interface can be either 3-wire or 4-wire.

Both main and subnode can transmit data at the same time. The data from the main or the subnode is synchronized on the rising or falling clock edge.
SHIFT REGISTER USING SPI ARDUINO FULL
SPI is a synchronous, full duplex main-subnode-based interface. This article provides a brief description of the SPI interface followed by an introduction to Analog Devices’ SPI enabled switches and muxes, and how they help reduce the number of digital GPIOs in system board design. Serial peripheral interface (SPI) is one of the most widely used interfaces between microcontroller and peripheral ICs such as sensors, ADCs, DACs, shift registers, SRAM, and others.
