WiSnap User Manual 2.21 04112011-JF
Page
37
of
66
If the LEDs are disabled using bits 0, 1, 2 above, you can then use the
show i
command to read
these GPIO.
<2.20>
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 ad-hoc 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 WiSnap 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
<2.20> reboot // the module must be rebooted for the alternate settings to take effect
On the remote host run your application or other software that opens and listens on the <port>.
Connect GPIO-5 to your embedded processor or other control signal. When GPIO-5 is driven high a
connection will be attempted. When drive low the connection will be closed.
Be sure to not to
drive the GPIO with more that 3.3 VDC or permanent damage to the module will occur.
If the connection to the remote host is successful GPIO-6 will go high. If the COMM OPEN and
REMOTE strings are set you should see the *OPEN* messages on the UART and the *HELLO* at the
remote host.
10.6
Setting Debug Print levels
There are a number of print functions that can be enabled to assist in debugging the operation and
status of the module. The following command is used to control these printouts.
set sys printlvl <value>
sets additional print functions. Value is a bit-mapped register that
controls which printout messages are sent to the UART.