Difference between revisions of "DESK-MP1-L/Peripherals/GPIOs"

From DAVE Developer's Wiki
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
 
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
 
|-  
 
|-  
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|ID#
 
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|{{oldid|1877|18177}}
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|2023/08/02
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|02/08/2023
 
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|DESK-MP1-L-1.0.0 release
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|DESK-MP1-L-1.0.0 release
 
|-
 
|-
Line 17: Line 15:
 
==Peripheral GPIOs ==
 
==Peripheral GPIOs ==
  
In [[ETRA_SOM | ETRA SOM]] there is an I/O Expander driven via i2c, with this ETRA can handle external pins in many different ways and most of them can be configured as GPIOs, these GPIOs are present in the J11 connector.
+
In [[ETRA_SOM | ETRA SOM]] there is an I2C I/O Expander: in this way, ETRA can handle several pins in different ways and most of them can be configured as GPIOs. These GPIOs are available in J11 connector.
There is no driver to configure and use these GPIOs, to configure and write/read the GPIOs you need to interact with I/O expander with i2c commands.
+
 
 +
To configure and write/read the GPIOs you need to configure the I/O expander via I2C commands.
  
 
=== Accessing the peripheral ===
 
=== Accessing the peripheral ===
  
==== Usage with i2c command ====
+
==== Usage with I2C command ====
  
Set all GPIO on output mode, all pin low
+
Set all GPIO on output mode, all pins low:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
Line 32: Line 31:
 
</pre>
 
</pre>
  
set all pin to high, one by one
+
Set all pin to high, one by one:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
Line 56: Line 55:
 
</pre>
 
</pre>
  
set all pin to high and set all to low one by one
+
Set all pin to high and set all to low one by one:
 +
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
 
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xff
 
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xff
Line 83: Line 83:
 
</pre>
 
</pre>
  
set gpio input mode, disable debounce
+
Set GPIO input mode, disable debounce:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
Line 95: Line 95:
 
</pre>
 
</pre>
  
Read input value
+
Read input value:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">

Latest revision as of 11:14, 8 January 2024

History
Issue Date Notes
2023/08/02 DESK-MP1-L-1.0.0 release


Peripheral GPIOs[edit | edit source]

In ETRA SOM there is an I2C I/O Expander: in this way, ETRA can handle several pins in different ways and most of them can be configured as GPIOs. These GPIOs are available in J11 connector.

To configure and write/read the GPIOs you need to configure the I/O expander via I2C commands.

Accessing the peripheral[edit | edit source]

Usage with I2C command[edit | edit source]

Set all GPIO on output mode, all pins low:

root@desk-mp1:~# i2cset -y 1 0x34 0x30 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x31 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x32 0x07

Set all pin to high, one by one:

root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x01
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x02
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x04
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x08
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x10
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x20
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x40
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x80
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x01
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x02
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x04
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x08
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x10
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x20
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x40
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x80
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x01
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x02
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x04

Set all pin to high and set all to low one by one:

root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x07

root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xfe
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xfd
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xfb
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xf7
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xef
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xdf
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xbf
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x7f
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xfe
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xfd
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xfb
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xf7
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xef
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xdf
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xbf
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x7f
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x06
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x05
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x03

Set GPIO input mode, disable debounce:

root@desk-mp1:~# i2cset -y 1 0x34 0x30 0x00
root@desk-mp1:~# i2cset -y 1 0x34 0x31 0x00
root@desk-mp1:~# i2cset -y 1 0x34 0x32 0x00

root@desk-mp1:~# i2cset -y 1 0x34 0x27 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x28 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x29 0x07

Read input value:

root@desk-mp1:~# i2cget -y 1 0x34 0x16
root@desk-mp1:~# i2cget -y 1 0x34 0x17
root@desk-mp1:~# i2cget -y 1 0x34 0x18