Embedded Interview Questions:
I2C interview questions
1. What do you mean by I2C communication? Explain with its diagram.
Ans. I2C stands for inter IC communication. It is two wire i.e. SDA and SCL half duplex communication protocol. It is single and multi master and slave communication protocol.
2. What is the application of I2C protocol?
Ans. It is connected with serial RAM, LCD, EEPROM and it use within the television sets.
3. Which of the following are the three hardware signals?
Ans. START, STOP, ACKNOWLEDGE.
4. Which performs the START signal?
Ans. Master performs the START signal,
5. Which pin provides the reference clock for the transfer of data?
Ans. SCL provides the reference clock for the transfer of data.
6. Which are handshake signal?
7. Can devices be added and removed while the system is running (Hot swapping) in I2C ?
Ans. Hot swapping is possible in I2C protocol
8. What is the standard bus speed in I2C ?
Ans. a standard bus speed is 100Kbps , fast mode is 400Kbps , fast mode plus is 1Mbps , high speed mode is 4Mbps , Ultra speed mode is 5 Mbps.
9.What is bus arbitration ?
Ans: Arbitration is the process to avoid conflict the data on bus when multi master start communication at the same time. In the arbitration – which is the lowest address of the salve, that salve will communication continues and other will be lost the arbitration.
10.Advantages and limitations of I2C communication ?
Ans: 1.Using I2C .. we can connect more slaves than SPI. 2. Cost effective compared to SPI.SPI 3.Different speeds available. 4. NO need of any GPIO pins. 5.hardware design implementation is simple than SPI because of 2 wire communication 6.Supports Multi master Communication 7. More complexity to write a program 8. Transfer of data speed(100 Kbps) is less than SPI(1 Mbps)
11. How many devices can be connected in a standard I2C communication?
Ans. As per theoretically we can connect up to 127 devices for 7Bit address and 2 ^10 devices will connect for 10Bit address. But practically depends on Capacitance load. If capacitance load is increase the speed will be reduced
12. Is it possible to have multiple masters in I2C?
Ans: Multi master is possible in I2C communication using Arbitration process.
13.What is the maximum distance of the I2C bus?
This depends on the load of the bus and the speed you run at. In typical applications, the length is a few meters (9-12ft). The maximum capacitive load has been specified (see also the electrical Spec’s in the I2C FAQ). Another thing to be taken into account is the amount of noise picked up by long cabling. This noise can disturb the signal transmitted over the bus so badly that it becomes unreadable.
The length can be increased significantly by running at a lower clock frequency. One particular application – clocked at about 500Hz – had a bus length of about 100m (300ft). If you are careful in routing your PCB’s and use proper cabling (twisted pair and/or shielded cable), you can also gain some length.If you need to go far at high speed, you can use an active current source instead of a simple pull-up resistor. Philips has a standalone product for this purpose. Using a charge pump also reduces “ghost signals” caused by reflections at the end of the bus lines.
14. Can I do galvanic decoupling of my I2C bus?
This is possible. The circuit is rather complex due to the bi-directional nature of the I2C bus.
The following figure shows a possible solution:
- 5 and 5′ : PNP like 2n2219 or BC557
- 6 and 6′ : NPN like 2n2222 or BC 547
- 1 and 1′ : 270 Ohm
- 2 and 2′ : 3300 Ohm
- 3 and 3′ : 1800 Ohm
- 4 and 4′ : 1000 Ohm
- Optocouplers : 6n139 , 4n27 or Til 111
Note: Since the speed of the I2C bus can be rather high, it is recommended to use a fast optocoupler. However, this circuit will not work on speeds higher then 10KHz. A 6N139 will do the job in all cases. The two PNP and the two NPN transistors can be any standard type, e.g. 2N2219 and 2N2222 (USA) or BC547 and BC557 (EUROPE).
15. How can I monitor the I2C bus?
Ans. There are a few commercial I2C monitor / debuggers around that can do this.
There is another possibility to do this: By using the stand-alone I2C controller PCF8584 from Philips. This chip has a certain mode in which it does not take part in the real I2C action but only records what is going on. It listens to all addresses, but does not generate any acknowledge. Using some software routines and a MCU you could build a universal I2C data logger.