
Shield pin configuration
11
Shield pin configuration
This chapter will help you configure the Arduino* shield pins.
To configure the Arduino* shield pins, do the following:
1.
Identify the Arduino* shield pin number of the pin you want to use, in the range IO0-IO19.
2.
Identify the functions available for the given pin, and select the function you want to use. Typical functions
are GPIO, PWM, UART, I
2
C, SPI, ADC. Only some functions are available on each pin.
3.
Determine which GPIO signals, if any, need to be configured to select the correct pin muxing option for the
selected function. Some pins only have a single function, or do not require mux control.
4.
Determine which GPIO signals, if any, need to be configured to select the pin buffer direction for input or
output, and determine the direction that is required.
5.
Determine which GPIO signals, if any, need to be configured to select the pullup resistor control, and
whether the pullup resistor should be enabled or disabled. For most pin functions, the pullup resistors
should typically be disabled. For GPIO input functions, the pullup resistor may optionally be enabled or
disabled, according to your needs.
6.
Export the above GPIO numbers for access in the Linux user-space environment (from the command
shell).
7.
Configure the above GPIO numbers for output.
8.
Assert the TRI_STATE_ALL signal to disconnect the shield pins.
9.
Set the above GPIO numbers to assert their output logic levels as high or low.
10.
Set the SoC GPIO pin mode for the required functionality.
11.
Deassert the TRI_STATE_ALL signal to reconnect the shield pins.
11.1
Configure IO5 as a GPIO input, with pullup resistor disabled
To configure IO5 as a GPIO input, with pullup resistor disabled, do the following:
1.
Refer to Table 2 for the GPIO number. According to Table 2, the GPIO number for IO5 is 13.
2.
According to Table 4, GPIO 43 pin-mux must be set to mode0 to select the GPIO.
3.
According to Table 7, GPIO 253 must be set to 0 to disable the output direction for IO5.
4.
According to Table 7, GPIO 221 must be set as a high-impedance input to disable the external pullup
resistor for IO5.
5.
According to Table 6, the TRI_STATE_ALL signal is controlled by GPIO 214.
After you have gathered all of this information, enter the following commands in Linux:
# echo 13 > /sys/class/gpio/export
# echo 253 > /sys/class/gpio/export
# echo 221 > /sys/class/gpio/export
# echo 214 > /sys/class/gpio/export
# echo high > /sys/class/gpio/gpio214/direction
# echo low > /sys/class/gpio/gpio253/direction
# echo in > /sys/class/gpio/gpio221/direction
# echo mode0 > /sys/kernel/debug/gpio_debug/gpio13/current_pinmux
# echo in > /sys/class/gpio/gpio13/direction
# echo low > /sys/class/gpio/gpio214/direction
You should be able to use IO5 as a GPIO input. For example:
# cat /sys/class/gpio/gpio13/value
Intel® Edison Kit for Arduino*
December 2014
Hardware Guide
Document Number: 331191-004
27