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
stable level. The low level indicates 0 (at this time, the line voltage is the local voltage ), the high level indicates 1 (the voltage is determined by the VDD of the component ). The SDA level can be changed only when the SCL line is low.5. Response Signal ACKThe I2C bus data is transmitted in bytes (8 bits). After each byte is sent, the device releases the data bus during the 9th pulses of the clock, the receiver sends an ACK (which lowers the pow
/EEPROM
Package, burn the firmware to the Development Board, and start the application to view the icon.
Summary:
The entire call process is: app
One problem is that this method changes the android native API. After all, it accesses the hardware. If you want to make a general app and want to use C/C ++ to improve efficiency, you can directly develop the ndk and compile the function into library files into the app project.
Another problem is hardware access permissions. If you do a generic app,
/* Chen 24c01 (1 k) memory I2C bus Experiment C language example single-byte and unsigned long integer read/write program sda scl can be any common I/O */// # Include # Define trytime 250// Number of attempts to perform the operation again when the operation fails// # Define SDA p42// Data line// # Define SCL p43// Clock line# Define i2cwrite 0xa0 // A2 A1 A0 is 0# Define i2cread 0xa1Unsigned char trytime;// Function declarationVoid i2c_write4byte (un
After the frequency of the DDR and arm changes, the I2C problem occurs again:
The previous processing logic is that when the sending buffer is empty, I will read the data in the receiving buffer, the result is determined based on the value of the data counter that reads the receiving buffer first after the interruption. The number of times the receiving FIFO is read is determined based on this value. The previous logic has always been good. This is b
specific access periods on the controller.I2c_algorithmStruct i2c_algorithm {
/* I2C transmission function pointer */int (* master_xfer) (struct i2c_adapter * adap, struct i2c_msg * msgs, int num ); /* smbus transmission function pointer */int (* smbus_xfer) (struct i2c_adapter * adap, 2010addr, unsigned short flags, char read_write, u8 command, int size, union i2
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
2. Use JNI to add service access interfaces at the application framework layer
The application cannot directly access the Hal layer. The JNI layer needs to access the Hal module and provide APIs. You can directly provide interfaces, but it is
Write Process
When the MCU performs write operations, it first sends the 7-bit address code of the device and the Write direction "0" (a total of 8 bits, that is, one byte ), after sending the message, the SDA line is released and 9th clock signals
IICVsSPIToday, in low-end digital communications applications, we are seen in IIC (inter-integrated circuit) and SPI (Serial peripheral Interface). The reason is that these two communication protocols are ideal for near- low-speed inter-chip
Data transfer format
(1) byte Transfer and response
Each byte must be an 8-bit length. During data transmission, the highest bit (MSB) is first transmitted. Each transmitted byte must follow one response bit (that is, a frame has nine digits ).
The following is a simple example:Only one host is set on the bus, and the host uses query read/writeMultiple slave machines are allowed on the bus, and the slave machine uses the hardware interruption function.*****************I started to use the
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
This article turns from: http://blog.csdn.net/qianjin0703/article/details/5894869
1. Overview
2. Data Structure
3. Adapter
4. I2c-core
5. Slave Device
1. Overview
1.1 Definition I2C inter-integrated circuit SMBUS System Management Bus, the I2C subset
1.2 Characteristics The amount of data exchanged is small. The requ
device-driven struct i2c_client-represents an i²c from the device struct i2c_board_info-created from the device i2c_board_info-creating a template I 2 c device macro, containing the name and address of the struct i2c_algorithm-represents the I²c transmission method struct I2C_BUS_RECOVERY_INFO-I2C bus recovery information? The newly added structure of the kernel is not very clear. External function Operation module_i2c_driver-Register I²C device driv
i2c_board_info-created from the device i2c_board_info-creating a template I 2 c device macro, containing the name and address of the struct i2c_algorithm-represents the I²c transmission method struct I2C_BUS_RECOVERY_INFO-I2C bus recovery information? The newly added structure of the kernel is not very clear. External function Operation module_i2c_driver-Register I²C device driven macro definition i2c_register_board_info-static declaration (registrat
". generally, you can ENTER "Yes"/"ENTER" all the way down. When I check the configuration, the "Yes" and "ENTER" are all the way down.
Enter at the terminal:
Sudo sensors-detect
Process:
Louis @ Ubuntu-desktop :~ $ Sudo sensors-detect# Sensors-detect revision 4171 (03:37:01-0700)This program will help you determine which kernel modules you needTo load to use lm_sensors most into tively. It is generally safeAnd recommended to accept the default answers to all question
Master_xfer member is set to NULL. If the adapter supports the SMBus protocol, it is necessary to implement Smbus_xfer, and if the Smbus_xfer pointer is set to NULL, then the SMBus protocol will be emulated via the I²c channel. The return value of the function that the master_xfer points to should be the number of messages that have been successfully processed, or the return negative indicates an error. Th
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.