WiSnap User Manual 4.41 05282015-ML
Page 34
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. For example
show i
will return
Port=30.
For example, to use the alternate functions of the LEDs, the sequence of commands would be:
1)
set sys iofunc 0x70 -
enable alternate function for GPIO 6, 5 and 4
2)
save -
store configuration
3)
reboot -
reboot the module
Another example uses GPIO7 to drive the DTR line on the WiSnap AAA Male (see section 2.6.4 for necessary jumper
configuration):
1)
set sys iofunc 8 -
sets PIO7 to be an alternate IO function
2)
save -
store configuration
3)
reboot -
reboot the module
set sys output 0x80 0x80 -
drives PIO7 (DTR) HIGH
set sys output 0 0x80 -
drives PIO7 (DTR) LOW
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:
1)
set ip host
<addr>
-
set the IP address of the remote host
2)
set ip remote
<port>
-
set the IP port of the remote host
3)
set sys iofunc 0x60 -
set alternate function for GPIO-5 and GPIO-6
4)
save -
store configuration
5)
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.
Warning:
Be sure to not to drive the GPIO with more than 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: