The Wandboard has 10 external GPIOs, of which 8 are exported to the external pinheader JP-4.
In the EDM standard, it is recommended to refer to the external GPIOs by pin number. Different CPU modules might use different pins, and then using names as EIM_DA8 can get confusing. Similarily, different EDM baseboards might use the gpios in different ways. What is SOUND_ON can be MOTOR_ENABLE on a different baseboard.
The external GPIOs are routed to pins 255 to 264 on the EDM connector.
iMX6 pins set in GPIO mode
On the Wandboard the external GPIOs correspond to the following IMX6 pins
|EDM connector pin||iMX6 pin name||iMX6 GPIO (bank, number)||sysfs name||JP-4 pin||Notes|
|pin 255||EIM_DA12||GPIO(3, 12)||gpio76||-|
|pin 256||EIM_DA11||GPIO(3, 11)||gpio75||4||Erroneusly called GPIO(3, 12) in baseboard schematics|
|pin 257||EIM_DA10||GPIO(3, 10)||gpio74||-|
|pin 258||EIM_D27||GPIO(3, 27)||gpio91||6|
|pin 259||EIM_D26||GPIO(3, 26)||gpio90||14|
|pin 260||EIM_BCLK||GPIO(6, 31)||gpio191||8|
|pin 261||EIM_DA8||GPIO(3, 8)||gpio72||16||Erroneusly called GPIO_18 in baseboard schematics|
|pin 262||ENET_RX_ER||GPIO(1, 24)||gpio24||10|
|pin 263||GPIO_19||GPIO(4, 5)||gpio101||18|
|pin 264||SD3_RST||GPIO(7, 8)||gpio200||12|
Accessing GPIOs from Linux userspace
The external GPIOs should appear under the /sys/class/gpio folder in Linux sysfs.
The number of a GPIO is determined by (bank-1) * 32 + number, so for instance GPIO(1,24) is located in the folder gpio24.
To set the a GPIO to input mode, that is that the CPU is reading the value of the GPIO, one can do a
# echo in > /sys/class/gpio/gpio24/direction
After this, the file
contains the signal read (0 or 1). GPIO signals are all 3.3V.
To set a GPIO into output mode (that is the board provides the signal), do a :
# echo out > /sys/class/gpio/gpio24/direction
and then set the value high by
# echo 1 > /sys/class/gpio/gpio24/value
or low by
# echo 0 > /sys/class/gpio/gpio24/value.
GPIO access on the Wand baseboard
Eight of the external GPIOs are visible on the JP-4 connector on the Wand baseboard.
Refer to the table above to find out the pin numbers.
In case additional GPIOs are needed, other pins, like the SPI pins can be set in GPIO mode and used as GPIOs (after disabling SPI in boardfile).
GPIO driven interrupts
It is possible to have interrupts to occur when a GPIO goes high or low. This can be done for instance by using the GPIO key driver.
An overview/tutorial: http://bec-systems.com/site/281/how-to-implement-an-interrupt-driven-gpio-input-in-linux