Difference between revisions of "I2C Address Converter Module SKU: CQRADDR001"

From CQRobot-Wiki
Jump to: navigation, search
(Raspberry Pi Example and Test Code)
(Raspberry Pi Example and Test Code)
 
Line 197: Line 197:
  
 
After toggling the DIP switch to change the address, power on again.
 
After toggling the DIP switch to change the address, power on again.
 +
----
 +
=='''Sensor Does Not Work Properly'''==
 +
 +
'''Answer:'''
 +
 +
*Ensure the sensor wiring is correctly connected to the development board;
 +
 +
*Verify that the board program is properly burned.
 +
 
----
 
----

Latest revision as of 04:23, 29 January 2026

I2C Address Converter Module

Description

LTC4316 I2C Address Translation Module is a practical I2C bus expansion tool designed to resolve I2C device address conflicts. This module can translate the fixed hardware address of an I2C device into a different communication address, enabling multiple devices with identical addresses to operate simultaneously on the same I2C bus.


Features

  • Efficient Address Conflict Solution: Based on the LTC4316IMS chip, it can translate the fixed hardware address of an I2C device into 127 distinct communication addresses, effectively resolving address conflicts on the I2C bus.
  • Wide Voltage Operating Range: Supports power supply voltages from 2.25V to 5.5V, ensuring compatibility with various logic level systems.
  • Hardware-Level Transparent Translation: Configures address offsets through a resistive voltage divider network and performs real-time address translation, remaining entirely transparent to both master and slave devices.
  • Flexible Address Configuration: Enables independent configuration of the high 3-bit and low 4-bit address offsets via the XORH/XORL pins using resistor voltage division, with support for quick switching via DIP switches.
  • Industrial-Grade Protection Design: Features separate interfaces for the master side (SCLIN/SDAIN) and slave side (SCLOUT/SDAOUT), providing clear signal flow isolation.
  • Standard Interface Compatibility: Equipped with dual interfaces—HY2.0mm 4P connectors and 2.54mm pin headers—for easy connection to various development boards and sensor modules.

Certification Documents

Media:CQRADDR001-CE-Certification.rar

Media:CQRADDR001-FCC-SDOC-Certification.rar

Pin Description and Size

CQRobot.jpg
CQRADDR001-1.jpg
CQRADDR001-2.jpg

Specification

CQRADDR001-3.jpg
CQRADDR001-4.jpg

Working Principle

CQRADDR001-5-1.jpg

Address Configuration

  • The module sets the address conversion value through voltage divider resistors at the XORH and XORL pins.


CQRADDR001-711.jpg


CQRADDR001-721.jpg


  • How to determine the resistance of welding resistor:


First, based on the data sheet, the module determines whether a specific bit in the I2C address is inverted by the voltage of the XORH or XORL pins (i.e., VXORH or VORL relative to VCC). In Table 2 and 3, a bit value of 1 indicates inversion, while 0 indicates no inversion.


CQRADDR001-73.jpg
CQRADDR001-75.jpg


Assuming the VCC is now 5V, set A3-A0 to the 1 0 0 0 mode (A3 inverting while A2-A0 not). This requires VOXRL/VCC to be 0.53125±0.015, general formula: [VCC/(R1+R2)]R1=VXORL.


Given the VCC of 5V and RLB of 100kΩ, the target VXORL should be 0.53125×5V=2.65625V. Substituting all parameters into the formula yields R2 ≈ 88.23529kΩ.


Since this calculated R2 is not the exact common resistance, it should be matched with the closest common resistance value and verified through formula validation.


Under this circumstance, the closest common resistance value to 88.23529kΩ is 86.6kΩ, so VXORL≈2.67953V, or VXORL/VCC≈0.53906. This ratio falls within 0.53125±0.015, making 86.6kΩ a suitable resistance value for RLT.


CQRADDR001-76.jpg

Connections and Examples

CQRADDR001-7.jpg

Arduino Example and Test Code

CQRADDR001-77.jpg

  • Sample Code:


#include <Wire.h>

void setup() {
  Serial.begin(9600);
  Wire.begin();
  Serial.println("Scan available I2C devices:");
}

void loop() {
  for(int addr = 1; addr < 127; addr++) {
    Wire.beginTransmission(addr);
    if(Wire.endTransmission() == 0) {
      if(Wire.requestFrom(addr, (byte)1) > 0) {
        Serial.print("✅ Available devices: 0x");
        if(addr < 16) Serial.print("0");
        Serial.println(addr, HEX);
        while(Wire.available()) Wire.read();
      }
    }
  }
  delay(3000);
}


  • Test Results:


CQRADDR001-78.jpg


Set the serial port to 9600. Open the serial port debugger to view the bidirectional I2C address. After toggling the DIP switch to change the address, power on again. The new address will appear in the serial port debugger.


Raspberry Pi Example and Test Code

First, visit the Raspberry Pi official website to download the system. You must select the download option in the frame below; otherwise, the sensor will not function properly.

CQRADDR001-791.jpg

  • Schematic Diagram of Raspberry Pi 4B pins:

CQRADDR001-80.jpg

CQRADDR001-81.jpg

CQRADDR001-82.jpg

Create a folder and a “.c” file, then write the code.

Media: I2C.rar

You can directly add to the compressed file.

CQRADDR001-83.jpg

gcc -Wall -g -o I2C I2C.c -lm

./I2C

Go to the folder created in the terminal, use GCC cross-compilation and run the file.

  • Sample Code:
include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
int main() {
    int file;
    char filename[20];
    
    printf("Scan available I2C devices...\n\n");
    
    snprintf(filename, 19, "/dev/i2c-1");
    file = open(filename, O_RDWR);
    if (file < 0) {
        printf("Error: Unable to open I2C bus\n");
        return 1;
    }
    
    printf("The discovered I2C device address:\n");
    
    for (int addr = 0x03; addr <= 0x77; addr++) {
        if (ioctl(file, I2C_SLAVE, addr) >= 0) {
            unsigned char buffer[1];
            if (read(file, buffer, 1) == 1) {
                printf("0x%02X\n", addr);
            }
        }
    }
    
    close(file);
    printf("\nScan completed\n");
return 0;}


  • Test Results:


CQRADDR001-85.jpg


After toggling the DIP switch to change the address, power on again.


Sensor Does Not Work Properly

Answer:

  • Ensure the sensor wiring is correctly connected to the development board;
  • Verify that the board program is properly burned.