I2C
Pin# | Pin Label | dev node |
---|---|---|
18 | I2C_0_SCL | /dev/i2c-0 |
20 | I2C_0_SDA | |
13 | I2C_1_SCL | /dev/i2c-2 |
15 | I2C_1_SDA |
This examples have written based on under the Ubuntu 22.04 and Linux kernel 5.15.0-46-generic
How to change I2C speed on BIOS
The default I2C speed is 400kHz. If you want to change the speed to 100kHz, 400kHz, 1MHz and 3.4MHz. first you should enter the BIOS.
Enter the BIOS
1. Power off your ODROID-H3.
2. Press the Power button on your ODROID-H3, then Press “DEL” key while booting.
3. You can see the pic as follow.
Move to "Chipset->SerialIO Configuration"
Change the I2C speed what you want
Save & exit the BIOS
How to find I2C slave address of devices on Ubuntu
This instruction was tested on Ubuntu 22.04 on Kernel 5.15
Install package
sudo apt install i2c-tools
Find your device's address with “i2cdetect”.
sudo i2cdetect -y -r [0 or 1 or 2]
If you wired your device to pin #18 and #20, then you can find the device's address with the following command.
odroid@odroid:~$ sudo i2cdetect -y -r 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- odroid@odroid:~$
Otherwise, if you connect to pin #13 and #15, you can find the address with this command.
odroid@odroid:~$ sudo i2cdetect -y -r 2 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- odroid@odroid:~$