3.3.5 I2C Application
By default, the RDX S100 enables I2C5 (physical pins 3 and 5) and I2C4 (physical pins 27 and 28) on the 40-pin header, with an I/O voltage of 3.3V.
- On the 40-pin header, you need to toggle the DIP switch to select between I2C5 and UART2. For specific details, please refer to the figure below:

For pin definitions, please refer to Pin Configuration and Definitions.
Please refer to /app/40pin_samples/test_i2c.py for detailed instructions on how to use I2C.
The pins mentioned below are provided as examples only. Port values may differ across platforms; always verify against your actual hardware setup. Alternatively, you can directly use the code under the /app/40pin_samples/ directory, which has already been verified on the board.
Testing Method
-
Run the test script:
python3 /app/40pin_samples/test_i2c.py -
First, list all currently enabled I2C buses in the system.
-
Enter a bus number to scan and identify which peripherals are connected to that bus.
-
Input the peripheral device address (in hexadecimal). The test program will then read one byte of data from the specified device.
Execution Output
root@ubuntu:/app/40pin_samples# ./test_i2c.py
Starting demo now! Press CTRL+C to exit
List of enabled I2C controllers:
/dev/i2c-0 /dev/i2c-1 /dev/i2c-2 /dev/i2c-3 /dev/i2c-4 /dev/i2c-5
Please input I2C BUS num:0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: UU -- -- -- UU -- -- UU -- -- -- UU -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- 44 -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Please input I2C device num(Hex):44
Read data from device 44 on I2C bus 0
read value= b'\x00'
Test Code
#!/usr/bin/env python3
import sys
import signal
import os
import time
# Import i2cdev
from i2cdev import I2C
def signal_handler(signal, frame):
sys.exit(0)
def i2cdevTest():
# device, bus = 0x51, 0
bus = input("Please input I2C BUS num:")
os.system('i2cdetect -y -r ' + bus)
device = input("Please input I2C device num(Hex):")
print("Read data from device %s on I2C bus %s" % (device, bus))
i2c = I2C(eval("0x" + device), int(bus))
value = i2c.read(1)
i2c.write(value)
print("read value=", value)
i2c.close()
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal_handler)
print("Starting demo now! Press CTRL+C to exit")
print("List of enabled I2C controllers:")
os.system('ls /dev/i2c*')
while True:
i2cdevTest()