SPI communication details, spi communication

Source: Internet
Author: User

SPI communication details, spi communication
SPI data transmission and receiving Mechanism
1 SPI Overview
SPI is a ring bus structure that operates in the master-slave mode. This mode usually has one master device and one or more slave devices and requires at least four lines (during Unidirectional transmission, the three lines can also be used), which is composed of ss (cs), sck, sdi, and sdo. the time sequence is actually very simple, mainly under the control of sck, two two-way shift registers are used for data exchange, allowing the MCU to adopt full-duplex synchronous serial mode. It only specifies how data is transmitted for each frame, and does not introduce the composition of the frame structure.
2 SPI features

2.1 master-slave mode

The communication between two SPI devices must be controlled by the master device. A master device can control multiple slave devices by providing Clock and SlaveSelect/ss, the SPI protocol also specifies that the ClockMaster device of the slave device is provided to the slave device through the SCK pin. The slave device itself cannot generate or control the Clock. If no Clock is provided, the slave device cannot work normally.

2.2 Data Transmission in synchronous Mode

The Master device generates the corresponding Clock pulse (ClockPulse) based on the data to be exchanged. The Clock Pulse forms the Clock Signal (Clock Signal), and the Clock Signal passes the Clock polarity (CPOL) the Clock Phase (CPHA) controls when data is exchanged between the two SPI devices and when the received data is docked for sampling to ensure that the data is transmitted synchronously between the two devices.

2.3 Data Exchange)

Data transmission between SPI devices is also called data exchange because the SPI protocol stipulates that an SPI device cannot act only as a "Transmitter" or "Receiver" during data communication) ". In each Clock cycle, the SPI device sends and receives a bit of data, which is equivalent to a bit of data being exchanged. To receive the control signal sent from the Master, a slave device must be able to be accessed by the Master device before that ). Therefore, the Master device must first use SS/CSpin to select the target device from the source device. During data transmission, the data received each time must be sampled before the next data transmission.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.