IIC Bus Study

IIC stady

年初开发GPIO模拟IIC Bus程序的时候,学习IIC spec摘录下来的内容

Introduce

The IIC-bus supports any IC fabrication process (NMOS, CMOS, bipolar). Two wires, serial data (SDA) and serial clock (SCL), carry information between the devices connected to the bus.

Each device is recognized by a unique address (whether it’s a microcontroller, LCD driver, memory or keyboard interface) and can operate as either a transmitter or receiver, depending on the function of the device.

 

 

Definition

1.    TransmitterThe device which sends data to the bus

2.    ReceiverThe device which receives data from the bus

3.    MasterThe device which initiates a transfer, generates clock signals and terminates a transfer

4.    SlaveThe device addressed by a master

5.    Multi-masterMore than one master can attempt to control the bus at the same time without corrupting the message

6.    ArbitrationProcedure to ensure that, if more than one master simultaneously tries to control the bus, only one is allowed to do so and the winning message is not corrupted

7.    SynchronizationProcedure to synchronize the clock signals of two or more devices

 

General characteristics

1.    Generation of clock signals on the I 2C -bus is always the responsibility of master devices

2.    Both SDA and SCL are bi-directional lines

3.    One clock pulse is generated for each data bit transferred.

4.    The data on the SDA line must be stable during the HIGH period of the clock.

5.    The HIGH or LOW state of the data line can only change when the clock signal on the SCL line is LOW

 

Start and Stop condition

START:

A HIGH to LOW transition on the SDA line while SCL is HIGH is one such unique case. This situation indicates a START condition.

   STOP:

   A LOW to HIGH transition on the SDA line while SCL is HIGH defines a STOP condition.

 

Fig.1 START and STOP Conditions

 

Notes:

   START and STOP conditions are always generated by the master. The bus is considered to be busy after the START condition. The bus is considered to be free again a certain time after the STOP condition.

 

Transferring data

1.    Every byte put on the SDA line must be 8-bits long. The number of bytes that can be transmitted per transfer is unrestricted.

2.    Each byte has to be followed by an acknowledge bit.

3.    Data is transferred with the most significant bit (MSB) first.

4.    Data transfer with acknowledge is obligatory. The acknowledge-related clock pulse is generated by the master.

5.    The acknowledge-related clock pulse is generated by the master. The transmitter releases the SDA line (HIGH) during the acknowledge clock pulse.

6.    The receiver must pull down the SDA line during the acknowledge clock pulse

7.    If a slave-receiver does acknowledge the slave address but, some time later in the transfer cannot receive any more data bytes, the master must again abort the transfer. This is indicated by the slave generating the NACK on the first byte to follow. The slave leaves the data line HIGH and the master generates a STOP or a repeated START condition.

If a master-receiver is involved in a transfer, it must signal the end of data to the slave-transmitter by not generating an ACK on the last byte that was clocked out of the slave. The slave-transmitter must release the data line to allow the master to generate a STOP or repeated START condition. 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值