User`s guide

RN-WIFLYCR-UG
www.rovingnetworks.com Version 1.2r 4/30/13 page 61
3.6.2.1 CONTROL GPIO DIRECTION WITH SET SYS MASK
You can control the GPIO pin direction with the GPIO mask using the set sys mask
<value> command, where <value> is entered as a hex number. The hex number rep-
resents a bitmask that controls each pin, where 1 = output and 0 = input. For example:
set sys mask 0x0 // Sets all pins as inputs
set sys mask 0xc0 // Set only GPIO6 and GPIO7
If you only need to set one bit in the mask, you need to read, mask, and set the value.
Otherwise, you will overwrite any previous GPIO settings.
The default mask for the RN-131 module is 0x20f0, which sets GPIO13, GPIO7,
GPIO6, GPIO5, and GPIO4 as outputs.
The default mask for the RN-171 module is 0x21f0, which corresponds to the following
settings:
GPIO0 - 3 are used internally on the module.
GPIO4 - 6 are LEDs.
GPIO 9 is reserved as the ARM factory reset/ad hoc mode (read at power up) and
otherwise general-purpose input detect pin.
GPIO10 - 11 are the UART RX and TX pins; TX does not need to be masked as
an output.
GPIO12 is CTS (input), if used.
GPIO13 is RTS (output), if used.
The RN-134 evaluation board’s LEDs are connected to GPIO4 - 6. To disable the LEDs,
enable the alternative functions of the LEDs (use the set sys iofunc 0x7 command).
The RN-174 evaluation board’s blue LED is connected to GPIO7, which is output by
default. The board does not drive this because GPIO7’s default power-up state is low.
The get sys command shows the setting of the GPIO mask as shown in Example 3-1.
EXAMPLE 3-1: GPIO MASK SETTING
Figure 3-8 shows the bits corresponding to the GPIO pins and Tab l e 3- 1 0 shows the
GPIO pin usage, their default state, and functionality.
Note: To set the GPIO pins as inputs or outputs instantly, use the set sys mask
0xABCD 1 command, which does not require a reboot.
Note: You can turn off the yellow, red, or green LEDs. The RN-134 board’s blue
LED is the power indicator and cannot be turned off.
<2.21> get sys
SleepTmr=……
IoFunc=0x0
IoMask=0x21f0