DESK-MP1-L/Peripherals/GPIOs

From DAVE Developer's Wiki
Jump to: navigation, search
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