Changes between Version 1 and Version 2 of ventana/DigitalIO


Ignore:
Timestamp:
04/27/2018 05:02:40 PM (7 years ago)
Author:
Tim Harvey
Comment:

convert restored html to wiki

Legend:

Unmodified
Added
Removed
Modified
  • ventana/DigitalIO

    v1 v2  
    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>
     1[[PageOutline]]
     2
     3= Ventana Digital IO and I2C
    474The 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>
    54 Ventana 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>
     5
     6
     7[=#dio]
     8= DIO and I2C Mapping
     9Ventana 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.
     10
    5711Ventana 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>
    133 The 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>
     12||= Board      =||= DIO(1) =||= Connector(2) =||= IMX6_PAD(3) =||= IMX6 GPIO(4) =||= linux gpio(5) =||= linux PWM(6) =||= I2C(7) ||
     13|| GW51xx       || DIO0 || J11.5        || PAD_SD1_DATA0        || GPIO1_IO16           || gpio-16      || -    || -
     14|| GW51xx       || DIO1 || J11.7        || PAD_SD1_DATA2        || GPIO1_IO19           || gpio-19      || PWM2 || -
     15|| GW51xx       || DIO2 || J11.6        || PAD_SD1_DATA1        || GPIO1_IO17           || gpio-17      || PWM3 || -
     16|| GW51xx       || DIO3 || J11.8        || PAD_SD1_CMD  || GPIO1_IO18           || gpio-18      || PWM4 || -
     17|| ||
     18|| GW52xx       || DIO0 || J4.1 || PAD_SD1_DATA0        || GPIO1_IO16           || gpio-16      || -    || i2c-2 SDA (9)
     19|| GW52xx       || DIO1 || J4.2 || PAD_SD1_DATA2        || GPIO1_IO19           || gpio-19      || PWM2 || i2c-2 SCL (9)
     20|| GW52xx       || DIO2 || J4.3 || PAD_SD1_DATA1        || GPIO1_IO17           || gpio-17      || PWM3 || -
     21|| GW52xx       || DIO3 || J4.4 || PAD_SD1_CLK          || GPIO1_IO20           || gpio-20      || -    || -
     22|| ||
     23|| GW53xx       || DIO0 || J4.1 || PAD_SD1_DATA0        || GPIO1_IO16           || gpio-16      || -    || i2c-2 SDA
     24|| GW53xx       || DIO1 || J4.2 || PAD_SD1_DATA2        || GPIO1_IO19           || gpio-19      || PWM2 || i2c-2 SCL
     25|| GW53xx       || DIO2 || J4.3 || PAD_SD1_DATA1        || GPIO1_IO17           || gpio-17      || PWM3 || -
     26|| GW53xx       || DIO3 || J4.4 || PAD_SD1_CLK          || GPIO1_IO20           || gpio-20      || -    || -
     27|| ||
     28|| GW54xx       || DIO0 || J16.1 || PAD_GPIO_9          || GPIO1_IO09           || gpio-9       || PWM1 || i2c-2 SDA
     29|| GW54xx       || DIO1 || J16.2 || PAD_SD1_DATA2       || GPIO1_IO19           || gpio-19      || PWM2 || i2c-2 SCL
     30|| GW54xx       || DIO2 || J16.3 || PAD_SD4_DATA1       || GPIO2_IO09           || gpio-41      || PWM3 || -
     31|| GW54xx       || DIO3(10) || J16.4 || PAD_SD4_DATA2   || GPIO2_IO10           || gpio-42      || PWM4 || -
     32|| ||
     33|| GW551x       || DIO1 || J3.19        || PAD_SD1_DATA2        || GPIO1_IO19           || gpio-19      || PWM2 || -
     34|| GW551x       || DIO2 || J3.20        || PAD_SD1_DATA1        || GPIO2_IO17           || gpio-17      || PWM3 || -
     35|| GW551x       ||      || J3.7 ||      || || ||                                || I2C SDA
     36|| GW551x       ||      || J3.8 ||      || ||   ||                      || I2C SCL
     37|| ||
     38|| GW552x       || DIO0 || J8.9 || PAD_SD1_DATA0        || GPIO1_IO16           || gpio-16      || -    || -
     39|| GW552x       || DIO1 || J8.11        || PAD_SD1_DATA2        || GPIO1_IO19           || gpio-19      || PWM2 || -
     40|| GW552x       || DIO2 || J8.10        || PAD_SD1_DATA1        || GPIO1_IO17           || gpio-17      || PWM3 || -
     41|| GW552x       || DIO3 || J8.12        || PAD_SD1_CLK  || GPIO1_IO20           || gpio-20      || -    || -
     42|| GW552x       || DIO4 || J8.15        || PAD_CSI0_PIXCLK      || GPIO5_IO18           || gpio-146     || -    || -
     43|| GW552x       || DIO5 || J8.17        || PAD_CSI0_DATA_EN     || GPIO5_IO20           || gpio-148     || -    || -
     44|| GW552x       || DIO6 || J8.16        || PAD_CSI0_VSYNC       || GPIO5_IO21           || gpio-149     || -    || -
     45|| GW552x       || DIO7 || J8.18        || PAD_CSI0_DAT4        || GPIO5_IO22           || gpio-150     || -    || -
     46|| GW552x       || DIO8 || J8.1 || PAD_CSI0_DAT5        || GPIO5_IO23           || gpio-151     || -    || -
     47|| GW552x       || DIO9 || J8.2 || PAD_CSI0_DAT7        || GPIO5_IO25           || gpio-153     || -    || -
     48|| ||
     49|| GW553x       || DIO0 || J10.5        || PAD_SD1_DATA0        || GPIO1_IO16           || gpio-16      || -    || -
     50|| GW553x       || DIO1 || J10.7        || PAD_SD1_DATA2        || GPIO1_IO19           || gpio-19      || PWM2 || -
     51|| GW553x       || DIO2 || J10.6        || PAD_SD1_DATA1        || GPIO1_IO17           || gpio-17      || PWM3 || -
     52|| GW553x       || DIO3 || J10.8        || PAD_SD1_CMD  || GPIO1_IO18           || gpio-18      || PWM4 || -
     53|| ||
     54|| GW16111(8)   || P0.0 || J12.1 (IO0)  || -    || -            || gpio-224     || -    || -
     55|| GW16111(8)   || P0.1 || J12.2 (IO1)  || -    || -            || gpio-225     || -    || -
     56|| GW16111(8)   || P0.2 || J12.3 (IO2)  || -    || -            || gpio-226     || -    || -
     57|| GW16111(8)   || P0.3 || J12.4 (IO3)  || -    || -            || gpio-227     || -    || -
     58|| GW16111(8)   || P0.4 || J13.1 (IO4)  || -    || -            || gpio-228     || -    || -
     59|| GW16111(8)   || P0.5 || J13.2 (IO5)  || -    || -            || gpio-229     || -    || -
     60|| GW16111(8)   || P0.6 || J13.3 (IO6)  || -    || -            || gpio-230     || -    || -
     61|| GW16111(8)   || P0.7 || J13.4 (IO7)  || -    || -            || gpio-231     || -    || -
     62|| GW16111(8)   || P1.0 || J14.1 (IO8)  || -    || -            || gpio-232     || -    || -
     63|| GW16111(8)   || P1.1 || J14.2 (IO9)  || -    || -            || gpio-233     || -    || -
     64|| GW16111(8)   || P1.2 || J14.3 (IO10) || -    || -            || gpio-234     || -    || -
     65|| GW16111(8)   || P1.3 || J14.4 (IO11) || -    || -            || gpio-235     || -    || -
     66|| GW16111(8)   || P1.4 || J15.1 (IO12) || -    || -            || gpio-236     || -    || -
     67|| GW16111(8)   || P1.5 || J15.2 (IO13) || -    || -            || gpio-237     || -    || -
     68|| GW16111(8)   || P1.6 || J15.3 (IO14) || -    || -            || gpio-238     || -    || -
     69|| GW16111(8)   || P1.7 || J15.4 (IO15) || -    || -            || gpio-239     || -    || -
     701. This is the signal name from the [http://www.gateworks.com/usermanuals ​Ventana hardware manuals]
     712. This is the connector pinout. The 5th pin on 5-pin connectors is GND
     723. Consult the IMX6 Reference manuals for PAD info: ​[http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf IMX6DQRM] [http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6SDLRM.pdf IMX6SDLRM]
     734. This is the GPIO block and IO the PAD is pinmux'd to when hwconfig is configured for GPIO
     745. This is the gpio mapped in linux accessible via /sys/class/gpio. Note that the pinmux and IO configuration are done by the [wiki:ventana/bootloader#DIOconfiguration bootloader], but you will need to manually export the GPIO to use it (see [wiki:gpio here] for details)
     756. This is the PWM that the PAD is pinmux'd to by the bootloader with hwconfig is conifgured for PWM. [wiki:ventana/bootloader#DIOconfiguration u-boot hwconfig to configure DIO pinmux/config]
     767. 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
     778. 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 & P1). Each IO has a series current limiting resistor of 332 Ohms.
     789. GW52xx does not have an i2c buffer for protection
     7910. 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.
     80
     81The pinmux and IO configuration is done by the bootloader depending on the hwconfig env variable. For information on how to configure that see [wiki:ventana/bootloader#hwconfig hwconfig]
     82
     83= Software GPIO Configuration
    13784Please 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>
    143 Please 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>
    148 See <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>
     85* [wiki:gpio GPIO basics and Linux configuration]
     86
     87
     88= Configuring GPIO Hardware
     89Typically not needed as defaults should work Please 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:
     90* [wiki:ventana/bootloader#DIOconfiguration u-boot hwconfig to configure DIO pinmux/config]
     91
     92
     93[=#pwm]
     94= Configuring PWM Hardware
     95See [wiki:linux/pwm linux/pwm]
     96
     97
     98
     99[=#external-i2c]
     100= External or off-board I2C support
     101Please consult the ​[http://www.gateworks.com/usermanuals Hardware Manuals] for pint output and support
     102
     103||= Model =||= external I2C Support     =||= Notes
     104|| GW551x       || Yes  || Does not have I2C buffer
     105|| GW51xx       || No   || Can add via GW16113
     106|| GW52xx       || Yes (Requires resistor loading)      || Does not have I2C buffer
     107|| GW53xx-B+    || Yes  || Has software controlled I2C buffer
     108|| GW54xx-B+    || Yes  || Has software controlled I2C buffer
     109|| GW552x       || No   || Can add via GW16113
    167110Ventana 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>
    177 Note 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>
     111
     112||= I2C Bus     =||= Linux Device       =||= Description
     113|| 1    || /dev/i2c-0   || GSC
     114|| 2    || /dev/i2c-1   || PMIC, System items
     115|| 3    || /dev/i2c-2   || Multimedia, HDMI, LVDS, Audio, User bus
     116
     117
     118== Accessing I2C on the board
     119Note that depending on the board model, there may be some i2c device addresses already in use. Please refer to this table:
     120
     121||= Device      =||= 7bit Address       =||= Present On =||= Notes
     122|| FXOS8700     || 0x1E || GW5400/GW5410/GW5300/GW5310  || Accelerometer / Magnetometer, Bus 3
     123|| SGTL5000     || 0x0A || GW5400/GW5300        || Analog Audio Codec
     124|| ADV7180      || 0x20 || GW5400/GW5300        || Analog Video Decoder Bus 3
     125|| ADV7393      || 0x2A || GW5400       || Analog Video Encoder
     126|| TDF19771     || 0x34 || GW5400       || HDMI Receiver
     127|| TDF19771     || 0x48 || GW5400       || HDMI Receiver CEC
     128|| HDMI EDID    || 0x50 || GW5xxx       || HDMI Monitor EDID device (If HDMI monitor plugged in)
     129 * 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)
     130 * The models listed are catalog parts only - components on Gateworks specials may vary (contact Sales for more info)
     131
    192132Many 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>
    198 Several 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>
    201 Note 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>
     133 * used for HDMI DDC channel to support EDID for boards supporting HDMI output
     134 * routed to DIO connector via softwtare configuration on most Ventana models.
     135
     136
     137=== I2C at the DIO connector
     138Several 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 [wiki:ventana/DigitalIO#external-i2c above])
     139
     140Note 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 (SCL/SDA).
     141
    204142For 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
     143
     1441. Confirm in the bootloader that DIO0 and DIO1 are set to GPIO in the hwconfig variable. These is the default configuration, so most likely no changes are needed:
     145{{{#!bash
     146Ventana > print hwconfig
    208147hwconfig=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}"
    212 Ventana &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>
    217 You 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>
     148}}}
     149 * Note above how dio0 and dio1 are set to gpio mode and not pwm mode
     1501. Set the I2C_EN signal (gpio-101) high to enable the I2C buffer by appending gpio set 101 to the bootloader bootcmd:
     151{{{#!bash
     152Ventana > setenv bootcmd "gpio set 101; ${bootcmd}"
     153Ventana > saveenv
     154}}}
     155 * We do this in the bootloader so that the i2c buffer is enabled by the time i2c kernel drivers are probing the bus.
     156 * This is not necessary on the GW52xx as it does not have an i2c buffer for protection.
     1571. Ensure you are not 'exporting' DIO0 and DIO1 gpios in Linux userspace as they will conflict with SDA/SCL if made to be outputs.
     158You can test by using a oscilloscope and probing the lines and issuing a command like shown below. You will see activity.
     159
    220160Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]
    221 </p>
    222 <p>
     161
    223162Example 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>
     163
     164Please adjust below example for actual bus and I2C address.
     165{{{#!bash
     166i2cget -f -y 2 0x20 0
     167}}}
     168
    230169A quick script to do the above commands for a GW5400:
    231 </p>
    232 <pre class="wiki">#!/bin/sh
     170{{{#!bash
     171#!/bin/sh
    233172
    234173# make DIO0 and DIO1 inputs to not conflict with I2C-2 SCL/SDA
    235 echo 9 &gt; /sys/class/gpio/export
    236 echo 19 &gt; /sys/class/gpio/export
    237 echo in &gt; /sys/class/gpio/gpio9/direction
    238 echo in &gt; /sys/class/gpio/gpio19/direction
     174echo 9 > /sys/class/gpio/export
     175echo 19 > /sys/class/gpio/export
     176echo in > /sys/class/gpio/gpio9/direction
     177echo in > /sys/class/gpio/gpio19/direction
    239178
    240179# enable I2C_EN
    241 echo 101 &gt; /sys/class/gpio/export
    242 echo out &gt; /sys/class/gpio/gpio101/direction
    243 echo 1 &gt; /sys/class/gpio/gpio101/value
    244 </pre><p>
     180echo 101 > /sys/class/gpio/export
     181echo out > /sys/class/gpio/gpio101/direction
     182echo 1 > /sys/class/gpio/gpio101/value
     183}}}
    245184Note 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>
     185
     186
     187=== I2C on HDMI output
    249188All 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>
     189
    252190References:
    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>
     191 * ​http://en.wikipedia.org/wiki/HDMI
     192
     193
     194== Accessing I2C From C Code
    257195The best reference is looking at the source code for the standard I2C tools available on the Linux command line.
    258 </p>
    259 <p>
     196
    260197See 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 }}}
     198 * ​https://lxr.missinglinkelectronics.com/linux/Documentation/i2c/dev-interface
     199 * https://github.com/groeck/i2c-tools/tree/master/tools
     200
     201
     202= Useful links
     203 * [wiki:gpio Linux GPIO and GPIO basics]
     204 * [wiki:linux/pwm Linux PWM and PWM basics]
     205 * [wiki:ventana/bootloader#DIOconfiguration u-boot hwconfig to configure DIO pinmux/config]
     206 * [http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf ​IMX6DQRM] (IMX6D/IMX6Q Reference manual)
     207 * [http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6SDLRM.pdf ​IMX6SDLRM] (IMX6S/IMX6DL Reference manual)