-1
\$\begingroup\$

Why do we need communication protocol and what is the difference between UART and i2c other than clock?

\$\endgroup\$

closed as off-topic by Oldfart, Chris Stratton, MCG, JYelton, Elliot Alderson Aug 5 at 16:05

  • This question does not appear to be about electronics design within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 7
    \$\begingroup\$ I'm voting to close this question as off-topic because it shows a lack of effort/research. \$\endgroup\$ – Oldfart Aug 5 at 15:10
  • 2
    \$\begingroup\$ Stack exchange sites are for the questions which remain after doing basic research. What have you learned in your reading and research on the subject so far? \$\endgroup\$ – Chris Stratton Aug 5 at 15:10
  • \$\begingroup\$ i know we use communication protocol to transfer data,uart and i2c are ways of communication,apart from the basic differences like clock,master slave,i want to know how to calculate clock speed in i2c \$\endgroup\$ – PRASH Aug 5 at 15:22
4
\$\begingroup\$

There are many differences, but to name a few:

  • Transmission speed for I2C is selectable from a few predefined values, serial can be any speed, from very low to very high
  • UART is typically for a point to point connection, I2C is a bus protocol
  • UART is not a protocol (see also remark of Justme below), I2C is a protocol
  • UART is (can be) full duplex, I2C is not
  • UART does not have a master/slave principle (no protocol), I2C has
  • UART can be used for transmission over distance, I2C is not meant for that.

So, there are a lot of differences. First find out what you need, than search the best protocol and hardware peripheral (UART, I2C, SPI, GPIO) for it.

\$\endgroup\$
  • \$\begingroup\$ how can we determine speed in i2c,i know in case of uart it is baud rate \$\endgroup\$ – PRASH Aug 5 at 15:17
  • 2
    \$\begingroup\$ @PRASH With an oscope? Or are you asking how you can configure a speed? I'd check with the datasheet of your master. \$\endgroup\$ – KingDuken Aug 5 at 15:18
  • \$\begingroup\$ It can be configured depending on the master as KingDuken mentions. See also i2c-bus.org/speed : The speed grades (standard mode: 100 kbit/s, full speed: 400 kbit/s, fast mode: 1 mbit/s, high speed: 3,2 Mbit/s) are maximum ratings. Compliant hardware guaranties that it can handle transmission speed up to the maximum clock rate specified by the mode. \$\endgroup\$ – Michel Keijzers Aug 5 at 15:47
  • 1
    \$\begingroup\$ Suppose i am using controller with 16Mhz which acts as master.how to set the standard mode speed of 100kbits/s in i2c \$\endgroup\$ – PRASH Aug 5 at 15:55
  • 1
    \$\begingroup\$ @MichelKeijzers one correction, RS-232 is not a protocol. It is only a physical interface or physical layer, meant for synchronous or asynchronous data exchange. UART is the device that is usually used to perform the asynchronous start stop link layer over RS-232 physical interface, but RS-232 does not itself define character encoding, character framing, bit transfer order, bit rates etc (except for the maximum). \$\endgroup\$ – Justme Aug 5 at 22:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.