Communication plays an essential role in the embedded system designing. Without going to the protocols, the peripheral expansion is highly complex and high-power consuming. The basically uses serial communication to communicate with the peripherals.There are many serial communication protocols, such as UART, CAN, USB, I2C and SPI communication. The serial characteristics include high speed and low data loss. It makes system-level designing easier, and ensures reliable data transfer. Serial Data CommunicationElectrically-coded information is called a serial data, which is transmitted bit by bit from one device to another through a set of protocols.
In the embedded system, control sensors and actuators data is received or transmitted to the controller devices such as microcontrollers so that the data is further analyzed and processed. As the microcontrollers work with the digital data, the information from the, actuators and other peripherals is converted into one byte (8-bit) binary word prior to being transmitted to the microcontroller.
Serial Data CommunicationThis serial data is transmitted with respect to certain clock pulse. The data transmission rate is referred to as the baud rate. The number of data bits that can be transmitted per second is called as baud rate. Suppose the data is of 12 bytes, then each byte is converted into 8bits so that the total size of the data transmission is about 96bits/sec of the data (12bytes.8 bits per byte). If the data can be transmitted once every second, the baud rates are around 96bits/sec or 96 baud. The display screen refreshes the data value once every second. Serial Peripheral Interface BasicsThe SPI communication stands for serial peripheral interface, which was developed by the Motorola in 1972.
SPI interface is available on popular communication controllers such as PIC, AVR, and, etc. It has synchronous serial communication data link that operates in full duplex, which means the data signals carry on both the directions simultaneously. SPI protocol consists of four wires such as MISO, MOSI, CLK, SS used for master/slave communication. The master is a microcontroller, and the slaves are other peripherals like sensors, and GPS modem, etc.
The multiple slaves are interfaced to the master through a SPI serial bus. The SPI protocol does not support the Multi-master communication and it is used for a short distance within a circuit board. Serial Peripheral Interface Basics SPI LinesMISO (Master in Slave out): The MISO line is configured as an input in a master device and as an output in a slave device. MOSI (Master out Slave in): The MOSI is a line configured as an output in a master device and as an input in a slave device wherein it is used to synchronize the data movement.SCK (serial clock): This signal is always driven by the master for synchronous data transfer between the master and the slave.
It is used to synchronize the data movement both in and out through the MOSI and MISO lines.SS (Slave Select) and CS (Chip Select): This signal is driven by the master to select individual slaves/Peripheral devices. It is an input line used to select the slave devices. Master Slave Communication with SPI Serial Bus Single Master and Single Slave SPI ImplementationHere, the communication is always initiated by the master. The master device first configures the clock frequency which is less than or equal to the maximum frequency that the slave device supports. The master then selects the desired slave for communication by dragging the chip select line (SS) of that particular slave device to go low state and active.
The master generates the information on to the MOSI line that carries the data from master to slave. Master Slave Communication Single Master and Multiple Slave ImplementationsThis is a multiple slave configuration with one master and multiple slaves through the SPI serial bus. The multiple slaves are connected in parallel to the master device with the SPI serial bus. Here, all the clock lines and data lines are connected together, but the chip select pin from each slave device must be connected to a separate slave select pin on the maser device. Single Master and multiple slavesIn this process, the control of each slave device is performed by a chip select line (SS).
Flaming pear flood. The chip select pin goes low to activate the slave device and goes high to disable the slave device.