I2C transmits data between devices connected to the bus using only two wires (SDA and SCL. each device is identified by a unique address (whether it is a microprocessor, LCD driver, memory, or keyboard interface) and can be used as a sender or receiver based on the functions of the device. the LCD driver may be a receiver, while the memory can send and receive data. in addition to transmitters and receivers
In fact, I have never used a 10-bit address or a universal broadcast address. the general broadcast address should be used for communications between multiple MCU using I2C. although it is useless, it is still translated and may be used in the future:
10bit address: the number of addresses that can be extended by 10bit addressing. devices with 7bit and 10bit addresses can connect to the same I2C
About I2C and SPI bus protocols
Iicvs SPI
Currently, in the low-end digital communication application field, we can see IIC (Inter-Integrated Circuit) and SPI (serial peripheral interface) everywhere. The reason is that these two communication protocols are very suitable for close-range and low-speed chip communication. Philips (for IIC) and Motorola (for Spi) have developed these two standard communication
AbstractFm31256 is a multi-functional storage chip based on I2C bus and powered by the iron and electronics technology. In addition to non-volatile memory, the device also provides real-time clock, low-voltage reset, watchdog counters, non-volatile event counters, lockable serial digital identification, and other features. This article mainly introduces the basic functions and principles of fm31256, and giv
Although Linux has its own I2C module, some peripherals need to use I2C to set registers. The I2C module in Linux is not so flexible, the following describes how to use an existing bus driver to write a device driver to implement I2C communication.
The main measure of
I2C bus protocol
I2C bus protocol learning notes1. I2C ProtocolTwo two-way serial lines, one data line SDA, and one clock line SCL.The data transmitted by SDA is transmitted at a large end. Each transmission is 8 bits, that is, one byte.Multimastering is supported,
I2C devices in the system can be found in the/sys/bus/I2C/devices directory, as follows:
View plaincopy to clipboardprint?# Ls0-00340-00300-00110-0058# Ls0-00340-00300-00110-0058
These devices exist in the system.
How did these devices come from?
In your machine configuration, you will execute the "i2c_register_board_info" function, which will register an i2c_boa
I²C transmits data between devices connected to the bus using only two lines (SDA and SCL). Each device is identified by a unique address (whether it is a microprocessor, LCD driver, memory, or keyboard interface) and can be used as a transmitter or receiver depending on the function of the device. The LCD driver may be just a receiver, and the memory can send and receive data. In addition to transmitters and receivers, the device can be used as a hos
Addressing of Bus
(1) Definition of addressing byte
I2C bus uses 7-bit addressing bytes, which are the first byte after the starting signal.
D7 ~ The address of the slave machine composed of D1 bits. D0 is the data transmission direction. If it is set to "0", it indicates that the host writes data to the slave database. If it is set to "1", it indicates that
I2C has never been touched before, so its simulation function can only rely on the feeling, there is something wrong, still hope that the House correct. With the SPI-related simulation function, it is not difficult to do I2C, but it is a little troublesome for users to read and write data through the I2C bus.Test program running interface: the
At present, most IO analog I2c bus programs on the Internet are query methods, which wastes a lot of CPU cycles for cyclic waiting. The program in this article uses the timer interrupt to push the state machine to simulate I2C bus operations,
The method of interruption is used. Please define the callback function. This
Based on Linux 2.6.30 Kernel
Conforms to the Linux driver architecture model
The page read and write operations for 24c08 are optimized.
Fully simulates the file read/write mode and supports lseek operations.
This Code contains the device address. When i2c_add_driver is used, it will detect whether there is a device on the address.
However, during board-level development, the i2c_device is placed in the Board file,
I2c_device and i2c_driver match with each other based on the name field.
Repri
Clock stretching (stretching)Clock stretching pauses a transmission by pulling the SCL line down. The transfer continues until the SCL line is released high. Clock stretching is optional, in fact most slave devices do not include the SCL driver, so they cannot stretch the clock.From a byte-level perspective, a device may accept data in fast mode, But more time is needed to store the bytes received or to prepare another byte to be transferred. The slave can pull the SCL line down after accepting
/system/bin
Adbpush I2cdump/system/bin
Adbpush I2cset/system/bin
ADB push I2cget/system/bin
-----------------------Below is an example of the use of these four commands
The i2c-tools contains four files.
· i2cdetect– used to list I2C bus and all the above devices.
· i2cdump– displays the value of all register on the device
· i2cget– read the value of a register
-$ (config_i2c_mux) = I2C-MUX.O
obj-y + + algos/busses/muxes/
ccflags-$ (config_i2c_debug_core): =-ddebug
The order of the visible links is i2c.-boardinfo, I2c-core, I2c-dev ... ...
Sequence of initialization functions for 1.2 I2C s
I recently checked the Linux 2.6.21 kernel's I2C driver and checked the relevant information on the Internet. I am also right about the error. I have some experience. Let's record it. There may be many mistakes in it. please correct them.1. I2C Protocol1.1 Working Principle of I2C busThe I2C
Linux under the I2C-driven loading process, divided into I2C equipment layer, I2C adapter layer and I2C core layer
The I2C device driver layer is the drive we write for a particular I2C device, and the following is the
Module_license ("GPL ");
Module_init (i2c_ts_init );Module_exit (i2c_ts_exit );
4 ). after completing this step, you also need to create and configure the I2C device where the setup file is located in linux-2.6.32.2/ARCH/ARM/mach-s3c2440/mach-mini2440.c, Add the following code: ................................. ................. +/* I2C touch screen devices. */ +/*
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.