Showing posts with label I2C. Show all posts
Showing posts with label I2C. Show all posts

September 7, 2024

Explore Our Topics!

Check out the extensive list of topics we discuss: 

  1. Communication Protocols:
    USB 
    - RS232 
    Ethernet 
    AMBA Protocol: APB, AHB and ASB 
    UART, I2C AND SPI
  2. Important concepts in VLSI:
    Designing a Chip? Here Are the 12 Important Concepts You Need to Know
    Metastability 
    - Setup time and Hold time
    Signal Integrity and Crosstalk effect
    Skews and Slack 
    Antenna Effect
  3. Semiconductor Memories
  4. Most Frequently Asked Questions in VLSI
  5. Transistors:
    BJT
    JFET
    MOSFET
    CMOS
    Transmission Gate CMOS
    Dynamic CMOS
  6. Sequential Circuits:
    Registers
    Counters
    Latches
    Flip Flops
  7. FPGA:
    ASIC vs FPGA
    FPGA Insights: From Concept to Configuration
    Full-Custom and Semi-Custom VLSI Designs: Pros, Cons and differences
    From Theory to Practice: CMOS Logic Circuit Design Rules Made Easy with Examples
  8. CMOS Fabrication:
    CMOS Fabrication
    Twin-Tub CMOS Technology
  9. Combinational Circuits
    - Logic Gates 
    - Boolean Algebra and DeMorgan's Law 
    - Multiplexer (MUX) and Demultiplexer (DEMUX) 
    - Half Adder
    - Full Adder
    - Half Subtractor
    - Full Subtractor
  10. Verilog
    - Verilog Datatypes
    - Comments, Numeral Formats and Operators
    - Modules and Ports
    - assign, always and initial keywords
    Blocking and Non-Blocking Assignments
    - Conditional Statements
    - Looping Statements
    - break and continue Statement
    - Tasks and Functions
    - Parameter and generate
    - Verilog Codes
  11. System Verilog: 
    Disable fork and Wait fork.
    Fork and Join.
  12. Project on Intel Quartus Prime and Modelsim:
    Vending Machine Controller
  13. Xilinx Vivado Projects
    1)VHDL
    Counters using Testbench code
    Flip Flops using Testbench code
    Logic Gates using Testbench code
    Full Adder using Half Adder and Testbench code
    Half Adder using Testbench code
    2)Verilog
    Logic Gates using Testbench code
    Counters using Testbench code
    Full Adder using Half Adder and Testbench code
    Half Adder using Testbench code
  14. VLSI Design Flow:
    Design Flow in VLSI
    Y chart or Gajski Kuhn Chart
  15. Projects on esim:
    Step-by-Step guide on how to Design and Implement a Full Adder using CMOS and sky130nm PDK
    Step-by-Step guide on how to Design and Implement a Half Adder using CMOS and sky130nm PDK
    Step-by-Step guide on how to Design and Implement a 2:1 MUX using CMOS and sky130nm PDK
    Step-by-Step guide on how to Design and Implement a Mixed-Signal Circuit of 2:1 Multiplexer
  16. IoT based project:
    Arduino
    Step-by-Step guide on how to Interface Load Cell using Arduino
  17. Kmaps:
    Simplifying Boolean Equations with Karnaugh Maps - Part:2 Implicants, Prime Implicants and Essential Prime Implicants. 
    Simplifying Boolean Equations with Karnaugh Maps - Part:1 Grouping Rules.
    Simplifying Boolean Equation with Karnaugh Maps.

March 28, 2023

Choosing the Right Communication Protocol: A Deep Dive into UART, I2C, and SPI.

Communication Protocols are a set of rules and syntax that allow two or more communication systems to transmit and receive data from one another.

1] UART

  • Full-Form: Universal Asynchronous Receiver Transmitter.
  • UART is a communication protocol that will allow data to transmit and receive data serially.
  • As the name suggests (Asynchronous), we do not use any clock cycle for data transmission and reception.
  • The Below diagram shows the basic block diagram of communication through UART.
  • As we don’t use any clock cycle, we need a package format for communication.
  • The Below diagram shows the Basic Block Diagram of the Package Format.

- Working:

1] Consider data sequence “10010101”

2] Initially the data bus is at High voltage, so to indicate the start and stop of data we increase or decrease the voltage level of START and STOP bit.

3] UART will receive the 8-bit data in a parallel way.

4] Start bit will be at 0 to indicate that the transmission of data has started. Similarly, the stop bit will be 1 to indicate transmission has ended.

5] LSB bit will be added in the data frame first.

6] Parity bit will be
0 — even no. of 1s.
1 — odd no. of 1s.
Here, we have even no. of 1s in data. Hence, we add 0+ in the bit.

7] UART will add 0+ (start bit), 0+ (parity bit) and 1+(stop bit) to the original data sequence at UART-1 (transmitting system) and similarly add 0- (start bit), 0- (parity bit) and 1- (stop bit) at UART-2 (receiving system).

8] As soon as UART-2 will receive 0+ from UART-1 it will be indicated that the next 8 bits will be the data bits and it will start reading those bits and stop at the parity bit 0+ and will verify the parity bit. If parity is the same it will stop receiving at 1+ stop bit.

  • In UART, data format and transmission speeds are configurable.
  • BAUD RATE: It is the rate of data transfer in serial communication. Expressed in bits per second (bps).
  • Depending on the Application, UART can be configured in 3-ways:

1] Simplex: One-way communication

2] Half Duplex: Communication can happen in both directions but not at the same time.

3] Full Duplex: Communication can happen in both directions at the same time.

  • Since Full duplex operations require characters to be sent and received at the same time, UART uses two different shift registers for transmitted and received characters.
  • Transmitting and receiving UARTs must be set for the same bit speed, character length, parity, and stop bit for proper operation.

- TYPES OF ERRORS:

1] OVERRUN ERROR: Occurs when the receiver cannot process the characters that just came in before the next one arrives.

2] UNDERRUN ERROR: Occurs when the UART transmitter has completed sending a character and transmitter buffer is empty.

3] FRAMING ERROR: UART will detect framing error when it does not see a stop bit at the expected stop bit time.

4] PARITY BIT: Occurs when the parity of the number of one-bits disagrees with that specified by the parity bit.

- ADVANTAGES:

1] Only uses two wires.

2] No clock signal is necessary.

3] Provide error detection by parity bit check.

4] Cost and size will be much lesser compared to the parallel communication

- DISADVANTAGES:

1] The size of the data frame is limited to 9 bits,

2] Doesn’t support multi-master and multi-slave systems.

3] We get less speed as compared to parallel communication.

2] I2C

  • Full-Form: Inter-Integrated Circuit
  • I2C is a Serial Communication protocol in which data is transferred bit by bit using a single wire (SDA).
  • I2C is a synchronous communication protocol that uses a clock cycle for data transmission and reception.
  • The Below diagram shows a basic block diagram of I2C.
  • I2C uses only two wires (SDA and SCL) for communication.

1] SDA — Serial Data Line is used to read/write data between two or more communication systems namely Master and Slave.

2] SCL — Serial Clock Line is used to control clock cycle from Master to Slave.

  • We can have multiple Master and Slave in I2C Communication Protocol.
  • Acknowledge Bit will be sent by the receiver to the transmitter to confirm that the data frame or characters have been delivered successfully.
  • Working-

Consider we have a single Master and 3 slaves as shown in the figure below

1] Start Condition: Initially, to write data from master to slave we need to make SDA voltage HIGH to LOW and then SCL voltage HIGH to LOW.

2] Slave Address + R/W bit: Consider, each slave will have its unique slave address.

- Slave 1: 0000001

- Slave 2: 0000010

- Slave 3: 0000011

  • Each slave will then be connected to the same clock pulse through the SCL pin.
  • Then, the Master will send W/R bit + required Slave address to all 3 slaves through the SDA line.
  • Consider we need to write data to slave 3 so Master will send W+0000011 to all 3 slaves.

3] Acknowledge Bit: Each slave will then compare address 0000011 with its unique slave address, if they are the same it will send Acknowledge Bit back to Master. Acknowledge bit will be sent by lowering the SDA voltage by 1 bit.

4] Master Send/Receiver: Master will then send data to respective slave in form of a Data frame.

5] For every data frame received acknowledge bit will be sent by the receiver.

6] Stop Condition: After receiving complete data we will make SCL voltage LOW to HIGH and then SDA HIGH to LOW.

  • I2C is a Half Duplex Communication Protocol
  • The typical Voltages used are +5V or +3.3V.

3] SPI

  • Full-Form: Serial Peripheral Interface
  • SPI is nothing but Synchronous Serial Communication Interface,
  • It uses a clock cycle for interfacing
  • It will transmit and receive data using 4 wires.

1] MOSI: Master out slave in

2] MISO: Master in slave out

3] SCLK: Serial clock

4] SS bar: Slave select

  • It can have a single Master and multiple slaves.
  • Slave select or chip select will decide which slave will receive the data.
  • The Below diagram shows a Basic block diagram of SPI.
  • The two most commonly used configurations are:

1] Independent slave configuration: It will have individual slave select pins for each slave. The below diagram shows the Block Diagram of Independent Slave Configuration.

2] Daisy Chain Configuration:

  • Here, we have the same slave select for all slaves but the MISO of 1st slave will be connected to the MOSI to 2nd till the last slave and then MISO of the last slave will be given as MISO of the master.

- Advantages:

1] It can perform Full Duplex operation as we have separate MISO and MOSI lines.

2] No use of start and stop bit, hence data can be interfaced continuously.

- Disadvantages:

1] Use of 4 wires, unlike I2C and SPI.

2] Can have only a single Master.

3] No acknowledgment bit to check whether the data has been received or not.

Like, Share, and Follow me if you like my content.
Thank You

Explore Our Topics!

Check out the extensive list of topics we discuss:  Communication Protocols: -  USB   - RS232   -  Ethernet   -  AMBA Protocol: APB, AHB and...