Wiki¶
- Table of contents
- Wiki
USB <-> I2C¶
SiLabs CP2112¶
Passerelle USB-I2C SiLabs CP2112
Arduino¶
#include <Arduino.h>
#include <Wire.h>
void setup(){
Wire.begin();
Serial.begin(9600);
}
void loop(){
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 8; address < 127; address++ ){
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0){
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error == 4) {
Serial.print("Unknow error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000);
}
https://arduino-france.site/i2c-scanner/
Commande Linux¶
i2c-tools
sudo apt install i2c-tools
sudo apt install i2c-tools
i2cdetect¶
i2cdetect -l
sudo i2cdetect -r -y N
N numero I2C ici 5
détection de puces I2C, TCA9535 0x20, ADS1115 0x48, PCF8563 0x51
i2cget¶
sudo i2cget 5 0x20 0x04
lecture dans le TCA9535 0x20, dans le registre 0x4
i2cset¶
sudo i2cset 5 0x20 0x02 0x01
écriture dans le TCA9535 0x20, dans le registre 0x2, les bits 0b00000001
https://www.acmesystems.it/i2c
https://www.youtube.com/watch?v=QwlqOTDAPfk
Composants¶
PCF8563 Real-time clock/calendar¶
VDD = 1.8 V to 5.5 V
400-kHz Fast I2C bus
@I2C 0x51
TCA9555 and TCA9535 I/O Expander 16-Bit¶
TCA9535 Low-Voltage 16-Bit I2C and SMBus Low-Power I/O Expander with Interrupt Output and Configuration Registers,
TCA9555 is identical to the TCA9535, except for the inclusion of the internal I/O pull-up resistor
VDD 1.65 V to 5 V
400-kHz Fast I2C bus.
@I2C
TCA9535
ADS1115 Quad ADCs¶
16-bit, 860-SPS, 4-channel, delta-sigma ADC with PGA, oscillator, VREF, comparator and I2C
VDD 2.0 V to 5.5 V
@I2C
0x48 | 0b1001000 | GND |
0x49 | 0b1001001 | VDD |
0x48 | 0b1001010 | SDA |
0x49 | 0b1001011 | SCL |
LTC2635 Quad DACs¶
Quad 12-/10-/8-Bit I2C VOUT
DACs with 10ppm/°C Reference
VDD 2.7V to 5.5V
@I2C
0x10 | 0b0010000 | GND |
0x11 | 0b0010001 | NC |
0x12 | 0b0010010 | VDD |
IP5306 Battery Management System¶
Fully-Integrated Power Bank System-On-Chip with 2.1A charger, 2.4A discharger
@I2C 0x75
IP5306
24LC512 EEPROM 512Kbit¶
VDD 2.5-5.5V
400-kHz Fast I2C bus
@I2C
|||A2|A1|A0|
|0x50|0b1010000|GND|GND|GND|
|0x51|0b1010001|GND|GND|VCC|
|0x52|0b1010010|GND|VCC|GND|
|0x53|0b1010000|GND|VCC|VCC|
|0x54|0b1010100|VCC|GND|GND|
|0x55|0b1010101|VCC|GND|VCC|
|0x54|0b1010110|VCC|VCC|GND|
|0x55|0b1010111|VCC|VCC|VCC|
24LC512
Updated by Frédéric Blanc 14 days ago · 40 revisions