WiFly GSX
www.rovingnetworks.com
WiFlyGSX-um 9/16/2010
809 University Avenue
•
Los Gatos, CA 95032
•
Tel (408) 395-6539
•
~ 35 ~
The IO function <value> is encoded as such:
Bit
IO
DIRECTION Function
0
GPIO-4
output
Disable LED function so IO can be used as GPIO
1
GPIO-5
output
Disable LED function so IO can be used as GPIO
2
GPIO-6
output
Disable LED function so IO can be used as GPIO
3
Not Used
4
GPIO-4
output
HIGH once associated/authenticated and have IP address.
5
GPIO-5
input
Set HIGH to trigger TCP connection, LOW to disconnect.
6
GPIO-6
output
HIGH when connected over TCP, LOW when disconnected.
NOTE. Bits 0-3 are mutually exclusive with the bits 4-6. i.e. 0x77 is an illegal value.
If the LEDs are disabled using bits 0, 1, 2 above, you can then use the
show i
command to read these GPIO.
<2.21>
show i
will return
Port=30
For example, to use the alternate functions of the LEDs, the sequence of commands would be:
set sys iofunc 0x70
// enable alternate function for GPIO 6, 5 and 4
save
// store configuration
reboot
// reboot the module
NOTE: Currently, the alternative GPIO functions are not available in adhoc mode.
10.5.2.
Controlling connections with GPIO
In embedded applications it is useful to monitor and control the status of the TCP/IP connection. This can
be done by using the alternate function for GPIO-5 and GPIO-6.
With the alternate function for these GPIO set, the module will connect to the stored remote host IP address
and port when GPIO-5 is driven high and disconnect when driven low.
The TCP/IP connection status can be monitored by reading GPIO-6, high = connected, low = not connected.
Here is how to set the WiFly module to connect using GPIO-5 and GPIO-6
<2.20> set ip host <addr> // set the IP address of the remote host
<2.20> set ip remote <port> // set the IP port of the remote host
<2.20> set sys iofunc 0x60 // set alternate function for GPIO-5 and GPIO-6
<2. 20> save
// save settings in config file
<2. 20> reboot
// reboot the module