I2C bus principle and application example
The I2C (Inter-Integrated Circuit) bus is a two-line serial bus developed by Philips to connect the microcontroller and its peripheral devices. The I2C bus was originally developed for audio and video devices in 1980s and is now mainly used in server management, including communication in the status of a
After completing the Platform_device addition, the I2C subsystem will perform the Platform_driver registration process.
Platform_driver registration by calling the initialization function I2c_adapter_s3c_init letter
Number to complete.
The I2c_adap_s3c_init () function body is as follows:
static int __init i2c_adap_s3c_init (void)
{return
platform_driver_register (s3c24xx_i2c_driver);
}Platform_driver_register (s3c24xx_i2c_driver), will complete the
at24c02d
at24c02d because it is not a standard I2C bus, the I2C 8-byte address bus select、read is not fully used, but the 5+3 external pin setting (A2,A1,A0) is used to determine which device to communicate with, and a I2C bus can mount up to 8 at24c02d, just 2 three times.
Do not understand why at24c02d I2C inside the
I'm confused about the I2C bus protocol? I was not quite clear when I first saw it. Let's take a look at the role of the I2C bus. Maybe this will give you a little bit of understanding.
I2C bus application
At present, many semiconductor integrated circuits have integrated I2C interfaces. Single-Chip Microcomputer with
The premise is that the driver of the I2C controller must have been running normally, the standard I2C tool can only read and write to 8-bit address, but the EEPROM of this 16-bit address will be powerless
So this kind of 16-bit address for read and write support, in the embedded domain is still very common
The main use of standard Linux I2C interface, struct i2c
Linux I2C driver architecture1. Linux I2C driver architecture in Linux, I2C BUS drivers are divided into two parts: BUS and DEVICE drivers ). The role of the bus driver is to add corresponding read/write methods for each I2C bus in the system. However, the bus driver does not communicate with each other. It only exists
The I2C architecture consists of three components:
(1) I2C Core
(2) I2C bus driver
(3) I2C Device Driver
I2C core: Provides the registration and cancellation methods for I2C bus drivers and device drivers, the upper layer of the
I2C bus signal timing Summary
Idle bus statusThe SDA and SCL signal lines of the I2C bus are in the idle state at the same time.At this time, the output-level FET of each device is in the cutoff state, that is, the bus is released.By the two signal lines of the respective pull-up resistance to raise the level.
Start SignalThe SDA level of the data line is lowered (that is, the negative hop) during the hig
EmbeddedLinux Bare Metal Development (13)--i²c communication a,IIC Protocol 1. Introduction ofIIC bus i2c (Inter - integrated circuit) bus is a philips The company developed a two-wire serial bus for connecting microcontrollers and peripherals. i2c Bus is a serial data bus, only two signal lines, one is two-way cable sda and the other one is the clock line scl
Address: http://blog.csdn.net/coder_jack/article/details/6419903
Send a start and stop command consecutively for the following test:
1. Send the start command to address an existing device, receive the ACK, and then send the Stop command. Everything is normal and the Stop waveform is displayed.
2. Send the start command to address a non-existing slave device. If no response is received, send the Stop command to release the bus and the waveform of the bus release cannot be seen. Only the check re
Principles, differences and Applications of SPI, I2C, and UART Serial Bus
1. UART is a two-line interface. One transmission and one receiving interface can communicate with each other in full duplex mode, and the number of lines is relatively small. Data is transmitted asynchronously, with strict timing requirements on both parties, and the communication speed is not fast. It is used most frequently for multi-host communication.2. Compared
During Android development and transplantation, you sometimes need to read and write a device, but the system may not provide the corresponding services. We need to develop our own hardware access service to control devices. The following example is the process of reading and writing the most simple I2C device EEPROM, I2C driver writing there are two ways, one is to use the
1.OV PWDN is a high level of effective, that is, high electricity peacetime camera sleep, at this time I2C also do not work (with i2cdetect detection), in low electricity peacetime camera work;
2.i2cdetect is a very good tool, you use this work, do not care about the device's register address and data bit width, as long as the device to ensure the operating voltage and its mount to which a I2C controller, y
1. Communication Interface
The data sent or received by I2C is encapsulated by the packet struct i2c_msg.
Struct i2c_msg {_ 2010addr; // slave address _ 2010flags; // flag # define i2c_m_ten 0x0010 // ten address flag # define i2c_m_rd 0x0001 // receives the data flag _ Len; // Data Length _ u8 * Buf; // Data Pointer };
ADDR indicates the slave address, flags indicates the communication, 0 indicates the sent data, and i2c_m_rd indicates the received d
ack and nack of I2C signal
We usually in debugging I2C may rarely pay attention to the nack signal, only know if the master send data, MSB first, LSB after sending a byte (8 bit), then Slave will reply to an ACK signal, but sometimes I2C Slave may send a nack signal, let's take a look at the nack signal.
1, from the spec under a paragraph:
2. Translation:
E
1. Get the source code of I2C tools
Reference: http://lm-sensors.org/wiki/I2CTools
$ Wget http://dl.lm-sensors.org/i2c-tools/releases/i2c-tools-3.1.0.tar.bz2
2. Compile the source code
$ Tar-jxvf i2c-tools-3.1.0.tar.bz2
$ I2c-tools-3.1.0 CD
$ Cc = arm-None-Linux-gnueabi-GCC
Debug I2C modules in the near future. I think I am the most familiar with I2C. One is that the Protocol price is simple, and the other is that this module is also available in the set-top box. However, this familiar thing has made me tune it for three days! Some of the failure lessons are summarized as follows to learn from yourself and later.
1. When there is no problem with all the time sequences, I modi
/************************************************************************** * i.mx6 AT24Cxx EEPROM Linu X I2c-gpio * Disclaimer: * Many times when we use the Linux system management hardware, more is through the chip controller, * but sometimes, we will also encounter the chip in the control is not enough, or in the design of the process of accidents, such as no * have thought controller exists, the content of this article is because For the fourth co
1. Communication interface
I2C send or receive data in packets struct I2C_MSG encapsulation
[CPP]
struct I2C_MSG {
__u16 addr; From machine address
__U16 flags; Sign
#define I2c_m_ten 0x0010//10-bit address flag
#define I2C_M_RD 0x0001//Receive data markers
__u16 Len; Data length
__u8 *buf; Data pointers
};
Where addr is the address of the machine; flags are the sign of this communication, sending the data as 0, and receiving the data as the number of
Differences:
SPI: high-speed synchronous serial port. 3 ~ 4-line interface, independent and synchronous sending and receiving
UART: Universal asynchronous serial port. Bidirectional communication based on the standard baud rate is slow
I2C: A three-line serial transmission mode. The communication protocol and usage can be found on the Internet.
Bidirectional data transmission with three linesSerial peripheral interfaceUART: Universal asynchronous tra
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.