Changes between Initial Version and Version 1 of ventana/DigitalIO


Ignore:
Timestamp:
10/22/2017 05:28:45 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ventana/DigitalIO

    v1 v1  
     1{{{#!html
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     4<ol>
     5  <li>
     6    <a href="#VentanaDigitalIOandI2C">Ventana Digital IO and I2C</a>
     7  </li>
     8  <li>
     9    <a href="#DIOandI2CMapping">DIO and I2C Mapping</a>
     10  </li>
     11  <li>
     12    <a href="#SoftwareGPIOConfiguration">Software GPIO Configuration</a>
     13  </li>
     14  <li>
     15    <a href="#ConfiguringGPIOHardware">Configuring GPIO Hardware</a>
     16  </li>
     17  <li>
     18    <a href="#ConfiguringPWMHardware">Configuring PWM Hardware</a>
     19  </li>
     20  <li>
     21    <a href="#Externaloroff-boardI2Csupport">External or off-board I2C support</a>
     22    <ol>
     23      <li>
     24        <a href="#AccessingI2Contheboard">Accessing I2C on the board</a>
     25        <ol>
     26          <li>
     27            <a href="#I2CattheDIOconnector">I2C at the DIO connector</a>
     28          </li>
     29          <li>
     30            <a href="#I2ConHDMIoutput">I2C on HDMI output</a>
     31          </li>
     32        </ol>
     33      </li>
     34    </ol>
     35  </li>
     36  <li>
     37    <a href="#AccessingI2CFromCCode">Accessing I2C From C Code</a>
     38  </li>
     39  <li>
     40    <a href="#Usefullinks">Useful links</a>
     41  </li>
     42</ol>
     43</div><p>
     44</p>
     45<h1 id="VentanaDigitalIOandI2C">Ventana Digital IO and I2C</h1>
     46<p>
     47The intent of this page is to provide information about Ventana single board computers off-board digital IO signals including I2C
     48</p>
     49<p>
     50<span class="wikianchor" id="mapping"></span>
     51</p>
     52<h1 id="DIOandI2CMapping">DIO and I2C Mapping</h1>
     53<p>
     54Ventana baseboards provide 4 digital IO signals to a connector.  The IMX6 has 7 GPIO blocks having 32 GPIO's each which get mapped to gpio0 - through gpio 223.  The various ventana product hardware manuals contain a table of what pins on the Digital IO connector routes to what IMX6 GPIO.  In some cases these signals can be pinmux'd internally to one of four IMX6 PWM's.
     55</p>
     56<p>
     57Ventana GPIO Mapping:
     58</p>
     59<table class="wiki">
     60<tr><th> <strong>Board</strong>  </th><th> <strong>DIO</strong><sub>(1)</sub>  </th><th> <strong>Connector</strong><sub>(2)</sub> </th><th> <strong>IMX6_PAD</strong><sub>(3)</sub> </th><th> <strong>IMX6 GPIO</strong><sub>(4)</sub> </th><th>  </th><th> <strong>linux gpio</strong><sub>(5)</sub> </th><th> <strong>linux PWM</strong><sub>(6)</sub> </th><th> <strong>I2C</strong><sub>(7)</sub>
     61</th></tr><tr><td> GW51xx         </td><td> DIO0 </td><td> J11.5     </td><td> PAD_SD1_DATA0 </td><td> GPIO1_IO16 </td><td> </td><td> gpio-16       </td><td> -         </td><td> -
     62</td></tr><tr><td> GW51xx         </td><td> DIO1 </td><td> J11.7     </td><td> PAD_SD1_DATA2 </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> -
     63</td></tr><tr><td> GW51xx         </td><td> DIO2 </td><td> J11.6     </td><td> PAD_SD1_DATA1 </td><td> GPIO1_IO17 </td><td> </td><td> gpio-17       </td><td> PWM3      </td><td> -
     64</td></tr><tr><td> GW51xx         </td><td> DIO3 </td><td> J11.8     </td><td> PAD_SD1_CMD   </td><td> GPIO1_IO18 </td><td> </td><td> gpio-18       </td><td> PWM4      </td><td> -
     65</td></tr><tr><td>
     66</td></tr><tr><td> GW52xx         </td><td> DIO0 </td><td> J4.1      </td><td> PAD_SD1_DATA0 </td><td> GPIO1_IO16 </td><td> </td><td> gpio-16       </td><td> -         </td><td> i2c-2 SDA <sub>(9)</sub>
     67</td></tr><tr><td> GW52xx         </td><td> DIO1 </td><td> J4.2      </td><td> PAD_SD1_DATA2 </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> i2c-2 SCL <sub>(9)</sub>
     68</td></tr><tr><td> GW52xx         </td><td> DIO2 </td><td> J4.3      </td><td> PAD_SD1_DATA1 </td><td> GPIO1_IO17 </td><td> </td><td> gpio-17       </td><td> PWM3      </td><td> -
     69</td></tr><tr><td> GW52xx         </td><td> DIO3 </td><td> J4.4      </td><td> PAD_SD1_CLK   </td><td> GPIO1_IO20 </td><td> </td><td> gpio-20       </td><td> -         </td><td> -
     70</td></tr><tr><td>
     71</td></tr><tr><td> GW53xx         </td><td> DIO0 </td><td> J4.1      </td><td> PAD_SD1_DATA0 </td><td> GPIO1_IO16 </td><td> </td><td> gpio-16       </td><td> -         </td><td> i2c-2 SDA
     72</td></tr><tr><td> GW53xx         </td><td> DIO1 </td><td> J4.2      </td><td> PAD_SD1_DATA2 </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> i2c-2 SCL
     73</td></tr><tr><td> GW53xx         </td><td> DIO2 </td><td> J4.3      </td><td> PAD_SD1_DATA1 </td><td> GPIO1_IO17 </td><td> </td><td> gpio-17       </td><td> PWM3      </td><td> -
     74</td></tr><tr><td> GW53xx         </td><td> DIO3 </td><td> J4.4      </td><td> PAD_SD1_CLK   </td><td> GPIO1_IO20 </td><td> </td><td> gpio-20       </td><td> -         </td><td> -
     75</td></tr><tr><td>
     76</td></tr><tr><td> GW54xx         </td><td> DIO0 </td><td> J16.1     </td><td> PAD_GPIO_9    </td><td> GPIO1_IO09 </td><td> </td><td> gpio-9        </td><td> PWM1      </td><td> i2c-2 SDA
     77</td></tr><tr><td> GW54xx         </td><td> DIO1 </td><td> J16.2     </td><td> PAD_SD1_DATA2 </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> i2c-2 SCL
     78</td></tr><tr><td> GW54xx         </td><td> DIO2 </td><td> J16.3     </td><td> PAD_SD4_DATA1 </td><td> GPIO2_IO09 </td><td> </td><td> gpio-41       </td><td> PWM3      </td><td> -
     79</td></tr><tr><td> GW54xx         </td><td> DIO3<sub>(10)</sub> </td><td> J16.4     </td><td> PAD_SD4_DATA2 </td><td> GPIO2_IO10 </td><td> </td><td> gpio-42       </td><td> PWM4      </td><td> -
     80</td></tr><tr><td>
     81</td></tr><tr><td> GW551x         </td><td> DIO1 </td><td> J3.19     </td><td> PAD_SD1_DATA2 </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> -
     82</td></tr><tr><td> GW551x         </td><td> DIO2 </td><td> J3.20     </td><td> PAD_SD1_DATA1 </td><td> GPIO2_IO17 </td><td> </td><td> gpio-17       </td><td> PWM3      </td><td> -
     83</td></tr><tr>
     84</tr><tr><td> GW551x         </td><td>  </td><td> J3.7     </td><td>  </td><td>  </td><td> </td><td style="text-align: center">        </td><td style="text-align: center">       </td><td> I2C SDA
     85</td></tr><tr><td> GW551x         </td><td>  </td><td> J3.8     </td><td>  </td><td>  </td><td> </td><td style="text-align: center">        </td><td style="text-align: center">       </td><td> I2C SCL
     86</td></tr><tr>
     87</tr><tr><td>
     88</td></tr><tr><td> GW552x         </td><td> DIO0 </td><td> J8.9      </td><td> PAD_SD1_DATA0   </td><td> GPIO1_IO16 </td><td> </td><td> gpio-16       </td><td> -         </td><td> -
     89</td></tr><tr><td> GW552x         </td><td> DIO1 </td><td> J8.11     </td><td> PAD_SD1_DATA2   </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> -
     90</td></tr><tr><td> GW552x         </td><td> DIO2 </td><td> J8.10     </td><td> PAD_SD1_DATA1   </td><td> GPIO1_IO17 </td><td> </td><td> gpio-17       </td><td> PWM3      </td><td> -
     91</td></tr><tr><td> GW552x         </td><td> DIO3 </td><td> J8.12     </td><td> PAD_SD1_CLK     </td><td> GPIO1_IO20 </td><td> </td><td> gpio-20       </td><td> -         </td><td> -
     92</td></tr><tr><td> GW552x         </td><td> DIO4 </td><td> J8.15     </td><td> PAD_CSI0_PIXCLK </td><td> GPIO5_IO18 </td><td> </td><td> gpio-146    </td><td> -         </td><td> -
     93</td></tr><tr><td> GW552x         </td><td> DIO5 </td><td> J8.17     </td><td style="text-align: right"> PAD_CSI0_DATA_EN</td><td> GPIO5_IO20 </td><td> </td><td> gpio-148    </td><td> -         </td><td> -
     94</td></tr><tr><td> GW552x         </td><td> DIO6 </td><td> J8.16     </td><td> PAD_CSI0_VSYNC  </td><td> GPIO5_IO21 </td><td> </td><td> gpio-149    </td><td> -         </td><td> -
     95</td></tr><tr><td> GW552x         </td><td> DIO7 </td><td> J8.18     </td><td> PAD_CSI0_DAT4   </td><td> GPIO5_IO22 </td><td> </td><td> gpio-150    </td><td> -         </td><td> -
     96</td></tr><tr><td> GW552x         </td><td> DIO8 </td><td> J8.1      </td><td> PAD_CSI0_DAT5   </td><td> GPIO5_IO23 </td><td> </td><td> gpio-151    </td><td> -         </td><td> -
     97</td></tr><tr><td> GW552x         </td><td> DIO9 </td><td> J8.2      </td><td> PAD_CSI0_DAT7   </td><td> GPIO5_IO25 </td><td> </td><td> gpio-153    </td><td> -         </td><td> -
     98</td></tr><tr><td>
     99</td></tr><tr><td> GW553x         </td><td> DIO0 </td><td> J10.5     </td><td> PAD_SD1_DATA0 </td><td> GPIO1_IO16 </td><td> </td><td> gpio-16       </td><td> -         </td><td> -
     100</td></tr><tr><td> GW553x         </td><td> DIO1 </td><td> J10.7     </td><td> PAD_SD1_DATA2 </td><td> GPIO1_IO19 </td><td> </td><td> gpio-19       </td><td> PWM2      </td><td> -
     101</td></tr><tr><td> GW553x         </td><td> DIO2 </td><td> J10.6     </td><td> PAD_SD1_DATA1 </td><td> GPIO1_IO17 </td><td> </td><td> gpio-17       </td><td> PWM3      </td><td> -
     102</td></tr><tr><td> GW553x         </td><td> DIO3 </td><td> J10.8     </td><td> PAD_SD1_CMD   </td><td> GPIO1_IO18 </td><td> </td><td> gpio-18       </td><td> PWM4         </td><td>
     103</td></tr><tr><td> -
     104</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.0 </td><td> J12.1 (IO0) </td><td> -             </td><td> -          </td><td> </td><td> gpio-224       </td><td> -         </td><td> -
     105</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.1 </td><td> J12.2 (IO1) </td><td> -             </td><td> -          </td><td> </td><td> gpio-225       </td><td> -         </td><td> -
     106</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.2 </td><td> J12.3 (IO2) </td><td> -             </td><td> -          </td><td> </td><td> gpio-226       </td><td> -         </td><td> -
     107</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.3 </td><td> J12.4 (IO3) </td><td> -             </td><td> -          </td><td> </td><td> gpio-227       </td><td> -         </td><td> -
     108</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.4 </td><td> J13.1 (IO4)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-228       </td><td> -         </td><td> -
     109</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.5 </td><td> J13.2 (IO5)     </td><td> -             </td><td> -          </td><td> </td><td> gpio-229       </td><td> -         </td><td> -
     110</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.6 </td><td> J13.3 (IO6)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-230       </td><td> -         </td><td> -
     111</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P0.7 </td><td> J13.4 (IO7)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-231       </td><td> -         </td><td> -
     112</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.0 </td><td> J14.1 (IO8)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-232       </td><td> -         </td><td> -
     113</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.1 </td><td> J14.2 (IO9)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-233       </td><td> -         </td><td> -
     114</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.2 </td><td> J14.3 (IO10)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-234       </td><td> -         </td><td> -
     115</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.3 </td><td> J14.4 (IO11)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-235       </td><td> -         </td><td> -
     116</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.4 </td><td> J15.1 (IO12)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-236       </td><td> -         </td><td> -
     117</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.5 </td><td> J15.2 (IO13)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-237       </td><td> -         </td><td> -
     118</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.6 </td><td> J15.3 (IO14)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-238       </td><td> -         </td><td> -
     119</td></tr><tr><td> GW16111<sub>(8)</sub> </td><td> P1.7 </td><td> J15.4 (IO15)    </td><td> -             </td><td> -          </td><td> </td><td> gpio-239       </td><td> -         </td><td> -
     120</td></tr><tr><td>
     121</td></tr></table>
     122<ol><li>This is the signal name from the <a class="ext-link" href="http://www.gateworks.com/usermanuals"><span class="icon">​</span>Ventana hardware manuals</a>
     123</li><li>This is the connector pinout.  The 5th pin on 5-pin connectors is GND
     124</li><li>Consult the IMX6 Reference manuals for PAD info: <a class="ext-link" href="http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf"><span class="icon">​</span>IMX6DQRM</a> <a class="ext-link" href="http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6SDLRM.pdf"><span class="icon">​</span>IMX6SDLRM</a>
     125</li><li>This is the GPIO block and IO the PAD is pinmux'd to when hwconfig is configured for GPIO
     126</li><li>This is the gpio mapped in linux accessible via /sys/class/gpio.  Note that the pinmux and IO configuration are done by the <a class="wiki" href="/wiki/ventana/bootloader#DIOconfiguration">bootloader</a>, but you will need to manually export the GPIO to use it (see <a class="wiki" href="/wiki/gpio">here</a> for details)
     127</li><li>This is the PWM that the PAD is pinmux'd to by the bootloader with hwconfig is conifgured for PWM. <a class="wiki" href="/wiki/ventana/bootloader#DIOconfiguration">u-boot hwconfig to configure DIO pinmux/config</a>
     128</li><li>GW54xx and GW53xx (revision B and above) can extend the 2nd CPU I2C bus (I2C3 available as /dev/i2c-2) out the DIO connector if gpio-101 is driven high.  see below
     129</li><li>The GW16111 is an expansion board for the GW551x family. It has a (PCA9555) digital io expansion chip that gives it 16 GPIO's. There are 2 8 bit ports for 16 bits total (P0 &amp; P1). Each IO has a series current limiting resistor of 332 Ohms.
     130</li><li>GW52xx does not have an i2c buffer for protection
     131</li><li>The GW5400 PWM4 can be routed to two different pads/connectors. By default the Ventana kernel device-tree's map PWM4 to the J6.5 backlight connector. If you want to use PWM4 as DIO3 on J16.4 you need to change the kernel device-tree and should contact ​support@… for details.
     132</li></ol><p>
     133The pinmux and IO configuration is done by the bootloader depending on the hwconfig env variable.  For information on how to configure that see <a class="wiki" href="/wiki/ventana/bootloader#DIOconfiguration">hwconfig</a>
     134</p>
     135<h1 id="SoftwareGPIOConfiguration">Software GPIO Configuration</h1>
     136<p>
     137Please visit this link to find out more information about using GPIO's in Linux
     138</p>
     139<ul><li><a class="wiki" href="/wiki/gpio">GPIO basics and Linux configuraiton</a>
     140</li></ul><h1 id="ConfiguringGPIOHardware">Configuring GPIO Hardware</h1>
     141<p>
     142<strong>Typically not needed as defaults should work</strong>
     143Please visit this link to find out how to configure the pin function and IO driver details (pull-up, drive str, etc) of the Digital IO pins:
     144</p>
     145<ul><li><a class="wiki" href="/wiki/ventana/bootloader#DIOconfiguration">u-boot hwconfig to configure DIO pinmux/config</a>
     146</li></ul><h1 id="ConfiguringPWMHardware">Configuring PWM Hardware</h1>
     147<p>
     148See <a class="wiki" href="/wiki/linux/pwm">linux/pwm</a>
     149</p>
     150<p>
     151<span class="wikianchor" id="external-i2c"></span>
     152</p>
     153<h1 id="Externaloroff-boardI2Csupport">External or off-board I2C support</h1>
     154<p>
     155<strong>Please consult the <a class="ext-link" href="http://www.gateworks.com/usermanuals"><span class="icon">​</span>Hardware Manuals</a> for pint output and support]
     156</strong></p>
     157<table class="wiki">
     158<tr><th> Model   </th><th> external I2C Support            </th><th> Notes                   
     159</th></tr><tr><td> GW551x    </td><td> Yes                               </td><td> Does not have I2C buffer 
     160</td></tr><tr><td> GW51xx    </td><td> No                                </td><td> Can add via GW16113       
     161</td></tr><tr><td> GW52xx    </td><td> Yes (Requires resistor loading)   </td><td> Does not have I2C buffer 
     162</td></tr><tr><td> GW53xx-B+ </td><td> Yes                               </td><td> Has software controlled I2C buffer
     163</td></tr><tr><td> GW54xx-B+ </td><td> Yes                               </td><td> Has software controlled I2C buffer
     164</td></tr><tr><td> GW552x    </td><td> No                                </td><td> Can add via GW16113
     165</td></tr></table>
     166<p>
     167Ventana boards rely heavily on the I2C bus for on-board devices. The IMX6 supports 4 i2c controllers and Ventana uses the first three as:
     168</p>
     169<table class="wiki">
     170<tr><th> I2C Bus       </th><th> Linux Device       </th><th> Description
     171</th></tr><tr><td> 1               </td><td> /dev/i2c-0           </td><td> GSC                 
     172</td></tr><tr><td> 2               </td><td> /dev/i2c-1           </td><td> PMIC, System items 
     173</td></tr><tr><td> 3               </td><td> /dev/i2c-2           </td><td> Multimedia, HDMI, LVDS, Audio, User bus
     174</td></tr></table>
     175<h2 id="AccessingI2Contheboard">Accessing I2C on the board</h2>
     176<p>
     177Note that depending on the board model, there may be some i2c device addresses already in use.  Please refer to this table:
     178</p>
     179<table class="wiki">
     180<tr><th> Device </th><th> 7bit Address </th><th> Present On                </th><th> Notes
     181</th></tr><tr><td> FXOS8700 </td><td> 0x1E           </td><td> GW5400/GW5410/GW5300/GW5310 </td><td> Accelerometer / Magnetometer, Bus 3
     182</td></tr><tr><td> SGTL5000 </td><td> 0x0A           </td><td> GW5400/GW5300               </td><td> Analog Audio Codec           
     183</td></tr><tr><td> ADV7180  </td><td> 0x20           </td><td> GW5400/GW5300               </td><td> Analog Video Decoder Bus 3       
     184</td></tr><tr><td> ADV7393  </td><td> 0x2A           </td><td> GW5400                      </td><td> Analog Video Encoder         
     185</td></tr><tr><td> TDF19771 </td><td> 0x34           </td><td> GW5400                      </td><td> HDMI Receiver               
     186</td></tr><tr><td> TDF19771 </td><td> 0x48           </td><td> GW5400                      </td><td> HDMI Receiver CEC           
     187</td></tr><tr><td style="text-align: right"> HDMI EDID</td><td> 0x50           </td><td> GW5xxx                      </td><td> HDMI Monitor EDID device (If HDMI monitor plugged in)
     188</td></tr></table>
     189<ul><li>Also note that this i2c bus goes to the LVDS Display connector which if used, may have i2c devices there as well (such as touchscreen controllers)
     190</li><li>The models listed are catalog parts only - components on Gateworks specials may vary (contact Sales for more info)
     191</li></ul><p>
     192Many Ventana boards provide the I2C3 (/dev/i2c-2) bus via an off-board connection:
     193</p>
     194<ul><li>used for HDMI DDC channel to support EDID for boards supporting HDMI output
     195</li><li>routed to DIO connector via softwtare configuration on most Ventana models.
     196</li></ul><h3 id="I2CattheDIOconnector">I2C at the DIO connector</h3>
     197<p>
     198Several Ventana boards can optionally configure the CPU I2C3 bus (/dev/i2c-2) SDA/SCL to route out to the Digital IO connector pins 1 (DIO0) and 2 (DIO1) respectively (see <a class="wiki" href="/wiki/ventana/DigitalIO#external-i2c">above</a>)
     199</p>
     200<p>
     201Note that on these boards that have i2c-2 off-board via DIO0/DIO1 capability, there are 4.7kohm pull-up's to <strong>3.3V</strong> on DIO0/DIO1 (SCL/SDA).
     202</p>
     203<p>
     204For those boards that have a software controlled I2C buffer, the buffer is disabled by default and to enable it you must:
     205</p>
     206<ol><li>Confirm in the <strong>bootloader</strong> that DIO0 and DIO1 are set to GPIO in the hwconfig variable. These is the default configuration, so most likely no changes are needed:
     207<pre class="wiki">Ventana &gt; print hwconfig
     208hwconfig=rs232;dio0:mode=gpio;dio1:mode=gpio;dio2:mode=gpio;dio3:mode=gpio
     209</pre><ul><li>Note above how dio0 and dio1 are set to gpio mode and not pwm mode
     210</li></ul></li></ol><ol start="2"><li>Set the I2C_EN signal (gpio-101) high to enable the I2C buffer by appending <tt>gpio set 101</tt> to the bootloader bootcmd:
     211<pre class="wiki">Ventana &gt; setenv bootcmd "gpio set 101; ${bootcmd}"
     212Ventana &gt; saveenv
     213</pre><ul><li>We do this in the bootloader so that the i2c buffer is enabled by the time i2c kernel drivers are probing the bus.
     214</li><li>This is not necessary on the GW52xx as it does not have an i2c buffer for protection.
     215</li></ul></li></ol><ol start="3"><li>Ensure you are not 'exporting' DIO0 and DIO1 gpios in Linux userspace as they will conflict with SDA/SCL if made to be outputs.
     216</li></ol><p>
     217You can test by using a oscilloscope and probing the lines and issuing a command like shown below.  You will see activity.
     218</p>
     219<p>
     220Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]
     221</p>
     222<p>
     223Example shown is on bus 3 (0 based, thus 2 is shown, address 0x20 and Data Address of 0)
     224</p>
     225<p>
     226<strong>Please adjust below example for actual bus and I2C address.</strong>
     227</p>
     228<pre class="wiki">i2cget -f -y 2 0x20 0
     229</pre><p>
     230A quick script to do the above commands for a GW5400:
     231</p>
     232<pre class="wiki">#!/bin/sh
     233
     234# make DIO0 and DIO1 inputs to not conflict with I2C-2 SCL/SDA
     235echo 9 &gt; /sys/class/gpio/export
     236echo 19 &gt; /sys/class/gpio/export
     237echo in &gt; /sys/class/gpio/gpio9/direction
     238echo in &gt; /sys/class/gpio/gpio19/direction
     239
     240# enable I2C_EN
     241echo 101 &gt; /sys/class/gpio/export
     242echo out &gt; /sys/class/gpio/gpio101/direction
     243echo 1 &gt; /sys/class/gpio/gpio101/value
     244</pre><p>
     245Note that on these boards that have i2c-2 off-board via DIO0/DIO1 capability, there are 4.7kohm pull-up's to 3.3V on DIO0/DIO1.
     246</p>
     247<h3 id="I2ConHDMIoutput">I2C on HDMI output</h3>
     248<p>
     249All boards that have HDMI output, route I2C3 to the HDMI connector. For pinout details see the HDMI specification for the specific connector type. Note that Type-A (standard HDMI) and Type-D (micro HDMI) have different pinouts.
     250</p>
     251<p>
     252References:
     253</p>
     254<ul><li><a class="ext-link" href="http://en.wikipedia.org/wiki/HDMI"><span class="icon">​</span>http://en.wikipedia.org/wiki/HDMI</a>
     255</li></ul><h1 id="AccessingI2CFromCCode">Accessing I2C From C Code</h1>
     256<p>
     257The best reference is looking at the source code for the standard I2C tools available on the Linux command line.
     258</p>
     259<p>
     260See links below:
     261</p>
     262<ul><li><a class="ext-link" href="https://lxr.missinglinkelectronics.com/linux/Documentation/i2c/dev-interface"><span class="icon">​</span>https://lxr.missinglinkelectronics.com/linux/Documentation/i2c/dev-interface</a>
     263</li><li><a class="ext-link" href="https://github.com/groeck/i2c-tools/tree/master/tools"><span class="icon">​</span>https://github.com/groeck/i2c-tools/tree/master/tools</a>
     264</li></ul><h1 id="Usefullinks">Useful links</h1>
     265<ul><li><a class="wiki" href="/wiki/gpio">Linux GPIO and GPIO basics</a>
     266</li><li><a class="wiki" href="/wiki/linux/pwm">Linux PWM and PWM basics</a>
     267</li><li><a class="wiki" href="/wiki/ventana/bootloader#DIOconfiguration">u-boot hwconfig to configure DIO pinmux/config</a>
     268</li><li><a class="ext-link" href="http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf"><span class="icon">​</span>IMX6DQRM (IMX6D/IMX6Q Reference manual)</a>
     269</li><li><a class="ext-link" href="http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6SDLRM.pdf"><span class="icon">​</span>IMX6SDLRM (IMX6S/IMX6DL Reference manual)</a>
     270</li></ul
     271}}}