odroid-h2:application_note:16port_i2c_gpio

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
odroid-h2:application_note:16port_i2c_gpio [2018/11/26 09:44]
john1117 created
odroid-h2:application_note:16port_i2c_gpio [2020/06/11 17:04] (current)
neal [Wiring]
Line 30: Line 30:
 ==== Wiring ==== ==== Wiring ====
 We're going to make an LED example with the GPIO expander([[http://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf|MCP23017 Datasheet]]).\\ We're going to make an LED example with the GPIO expander([[http://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf|MCP23017 Datasheet]]).\\
- +<tabbox H2+> 
-{{:odroid-h2:application_note:i2c_io_expander.jpg?600|}}\\+{{:odroid-h2:application_note:h2plus_i2c_io_expander.jpg?600|}} 
 +<tabbox H2> 
 +{{:odroid-h2:application_note:i2c_io_expander.jpg?600|}} 
 +</tabbox>
 Download fritzing\\ Download fritzing\\
 - MCP23017 board part ☞ {{ :odroid-h2:application_note:i2c_io_expander.fzpz |}}\\ - MCP23017 board part ☞ {{ :odroid-h2:application_note:i2c_io_expander.fzpz |}}\\
 +- ODROID-H2+ part ☞ {{ :odroid-h2:application_note:odroid-h2plus.fzpz |}}\\
 - ODROID-H2 part ☞ {{ :odroid-h2:application_note:odroid-h2.fzpz |}}\\ - ODROID-H2 part ☞ {{ :odroid-h2:application_note:odroid-h2.fzpz |}}\\
-- fritzing parts ☞ {{ :odroid-h2:application_note:i2c_io_expander.fzz |}}\\+- fritzing parts(H2) ☞ {{ :odroid-h2:application_note:i2c_io_expander.fzz |}}\\ 
 +- fritzing parts(H2+) ☞ {{ :odroid-h2:application_note:h2plus_i2c_io_expander.fzz |}}\\
  
 ==== Connection Check ==== ==== Connection Check ====
 If you have done the wiring well, you can see the device as the following commands. If you have done the wiring well, you can see the device as the following commands.
   sudo apt install i2c-tools   sudo apt install i2c-tools
-When you have wired the I/expander to Pin #18(SCL) and #20(SDA).+ 
 +  * <color #ed1c24>If you're using an older kernel than 4.18, tap the "Old kernel version".</color> 
 + 
 +<tabbox kernel 4.18 or higher> 
 +<WRAP group> 
 +When you have wired the GPIO expander to Pin #18(SCL) and #20(SDA). 
 +  sudo i2cdetect -y -r 2 
 +When you have wired the GPIO expander to Pin #13(SCL) and #15(SDA). 
 +  sudo i2cdetect -y -r 3 
 +</WRAP> 
 +<tabbox Old kernel version> 
 +<WRAP group> 
 +When you have wired the GPIO expander to Pin #18(SCL) and #20(SDA).
   sudo i2cdetect -y -r 5   sudo i2cdetect -y -r 5
-When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).+When you have wired the GPIO expander to Pin #13(SCL) and #15(SDA).
   sudo i2cdetect -y -r 6   sudo i2cdetect -y -r 6
 +</WRAP>
 +</tabbox>
 +
 ==== Install & build python packages ==== ==== Install & build python packages ====
   sudo apt install git python3-dev libi2c-dev python3-smbus   sudo apt install git python3-dev libi2c-dev python3-smbus
Line 57: Line 77:
 </code> </code>
 ==== Get source code ==== ==== Get source code ====
-  git clone https://github.com/seungchar/16port_i2c_gpio.git+  git clone https://github.com/hardkernel/16port_i2c_gpio.git
  
 ==== Run led_example ==== ==== Run led_example ====
Line 75: Line 95:
   -a, --all    All off or on   -a, --all    All off or on
 </code> </code>
 +
 +  * <color #ed1c24>If you're using an older kernel than 4.18, tap the "Old kernel version".</color>
 +
 +<tabbox kernel 4.18 or higher>
 +<WRAP group>
 +<WRAP column>
 +When you have wired the GPIO expander to Pin #18(SCL) and #20(SDA).
 +  sudo ./mcp23017.py 2 blink
 +  sudo ./mcp23017.py 2 -w 0 1
 +  sudo ./mcp23017.py 2 -r 5
 +</WRAP>
 +<WRAP column>
 +When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).
 +  sudo ./mcp23017.py 3 blink
 +  sudo ./mcp23017.py 3 -w 0 1
 +  sudo ./mcp23017.py 3 -r 5
 +</WRAP>
 +</WRAP>
 +<tabbox Old kernel version>
 +<WRAP group>
 +<WRAP column>
 +When you have wired the GPIO expander to Pin #18(SCL) and #20(SDA).
 +  sudo ./mcp23017.py 5 blink
 +  sudo ./mcp23017.py 5 -w 0 1
 +  sudo ./mcp23017.py 5 -r 5
 +</WRAP>
 +<WRAP column>
 +When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).
   sudo ./mcp23017.py 6 blink   sudo ./mcp23017.py 6 blink
   sudo ./mcp23017.py 6 -w 0 1   sudo ./mcp23017.py 6 -w 0 1
   sudo ./mcp23017.py 6 -r 5   sudo ./mcp23017.py 6 -r 5
 +</WRAP>
 +</WRAP>
 +</tabbox>
  
 {{https://dn.odroid.com/source_peripherals/h2/example_led_i2cgpio.gif?400|}} {{https://dn.odroid.com/source_peripherals/h2/example_led_i2cgpio.gif?400|}}
- +===== Changing the I2C speed ===== 
-=== GPIO toggle frequency on mcp23017 === +  * [[:odroid-h2:application_note:i2c#how_to_change_i2c_speed_on_bios|How to change I2C speed on BIOS]] 
-== 1MHz I2C Speed ==+==== GPIO toggle frequency on mcp23017 ==== 
 +=== 1MHz I2C Speed ===
 {{odroid-h2:app:toggle_gpio_1m.png?400|}} {{odroid-h2:app:toggle_gpio_1m.png?400|}}
-== 400kHz I2C Speed ==+=== 400kHz I2C Speed ===
 {{odroid-h2:app:toggle_gpio_400k.png?400|}} {{odroid-h2:app:toggle_gpio_400k.png?400|}}
-== 100kHz I2C Speed ==+=== 100kHz I2C Speed ===
 {{odroid-h2:app:toggle_gpio_100k.png?400|}} {{odroid-h2:app:toggle_gpio_100k.png?400|}}
-=== GPIO output current ===+==== GPIO output current ====
 Output Low : 8.0mA\\ Output Low : 8.0mA\\
 Output High : 3.0 mA Output High : 3.0 mA
  
  
  • odroid-h2/application_note/16port_i2c_gpio.1543193092.txt.gz
  • Last modified: 2018/11/26 09:44
  • by john1117