Wiki » History » Revision 39
Revision 38 (Frédéric Blanc, 2024-11-08 14:09) → Revision 39/40 (Frédéric Blanc, 2024-12-09 15:24)
h1. Wiki {{toc}} h2. USB <-> I2C h3. SiLabs CP2112 !clipboard-202411051457-ujwet.png! Passerelle USB-I2C SiLabs CP2112 h3. Arduino <pre><code class="cpp"> #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); } </code></pre> https://arduino-france.site/i2c-scanner/ h3. Commande Linux h4. i2c-tools <pre><code class="shell"> sudo apt install i2c-tools </code></pre> h5. i2cdetect <pre><code class="shell"> i2cdetect -l </code></pre> !clipboard-202411051520-zo9bt.png! <pre><code class="shell"> sudo i2cdetect -r -y N </code></pre> N numero I2C ici 5 !clipboard-202411081354-28b9g.png! détection de puces I2C, TCA9535 0x20, ADS1115 0x48, PCF8563 0x51 h5. i2cget <pre><code class="shell"> sudo i2cget 5 0x20 0x04 </code></pre> !clipboard-202411081405-bcbfj.png! lecture dans le TCA9535 0x20, dans le registre 0x4 h5. i2cset <pre><code class="shell"> sudo i2cset 5 0x20 0x02 0x01 </code></pre> !clipboard-202411081403-zlizw.png! écriture dans le TCA9535 0x20, dans le registre 0x2, les bits 0b00000001 https://www.acmesystems.it/i2c https://www.youtube.com/watch?v=QwlqOTDAPfk h2. Composants h3. PCF8563 Real-time clock/calendar !clipboard-202411071057-aw2q3.png! VDD = 1.8 V to 5.5 V 400-kHz Fast I2C bus *@I2C 0x51* document#245 h3. TCA9535 I/O Expander 16-Bit Low-Voltage 16-Bit I2C and SMBus Low-Power I/O Expander with Interrupt Output and Configuration Registers, !clipboard-202411071059-exmd3.png! VDD 1.65 V to 5 V 400-kHz Fast I2C bus. *@I2C* !clipboard-202411071120-iho0j.png! document#243 h3. ADS1115 Quad ADCs 16-bit, 860-SPS, 4-channel, delta-sigma ADC with PGA, oscillator, VREF, comparator and I2C !clipboard-202411071414-qcbtd.png! VDD 2.0 V to 5.5 V *@I2C* |0x48|0b1001000|GND| |0x49|0b1001001|VDD| |0x48|0b1001010|SDA| |0x49|0b1001011|SCL| document#242 h3. LTC2635 Quad DACs Quad 12-/10-/8-Bit I2C VOUT DACs with 10ppm/°C Reference !clipboard-202411081042-w1dol.png! VDD 2.7V to 5.5V *@I2C* |0x10|0b0010000|GND| |0x11|0b0010001|NC| |0x12|0b0010010|VDD| document#244 h3. IP5306 Battery Management System Fully-Integrated Power Bank System-On-Chip with 2.1A charger, 2.4A discharger !clipboard-202411081112-fltgj.png! *@I2C 0x75* document#246 h3. 24LC512 EEPROM 512Kbit !clipboard-202411081325-eulk2.png! 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| document#247