WiFly Serial Adapter
www.rovingnetworks.com
wifly-serial-um 6/30/2010
809 University Avenue
•
Los Gatos, CA 95032
•
Tel (408) 395-6539
•
~ 10 ~
save
// Save configuration>
Note: If autoconn=1, the WiFly will only make one attempt to auto connect.
Step 3: Set the wake up and sleep conditions. By default the serial adapter will wake whenever there is
data written to the serial interface. You can also configure the device to wake up on CTS, on a PIO or timer.
See the WiFly GSX user manual for details. We are going to set this up to wake on a timer then sleep after
2 minutes if there is no connection or if connected and no data has been transferred for 30 seconds.
set sys sleep 120
// sleep after 2 minutes if no connection
set sys trigger 2
// wake on CTS
set conn idle 30
// disconnect after 30 seconds of no data
save
// save all the settings to the config file
reboot
// use the new settings
This setup can be tested using TCP server application that opens a socket on port 3000. Port Peeker is a
free application that you can download off the web.
It is available at
http://www.linklogger.com/portpeeker.htm
2.4.
Waiting for the remote host to connect to the serial adapter (listen mode
)
In this example we are using a static IP so that the remote host knows where the WiFly Serial adapter is on
the network. Alternatively you can write your application software to listen for the broadcast UDP packet
(automatically sent by WiFly by default) to identify the WiFly Serial adapter and get the IP address and
TCP port number that the WiFly is listening on.
Step 1: Set up the wlan properties so the device will connect to the network automatically upon power up.
In this example we want to connect to the wireless network my_network.
set wlan join 1
// Auto join upon power up
set wlan chan 1
// only look on channel 1
set wlan ssid my_network
// Network name
set wlan phrase my_secret_code
// Pass phrase
Step 2: Configure the WiFly static IP address so the remote application can connect,
turn off DHCP and set
the IP address and netmask.
set ip address 10.20.20.63
// Set the IP address
set ip port 5030
// Set the local port to listen on
set ip netmask 255.255.255.0
// Set the IP netmask
set ip gateway 10.20.20.1
// Sets the network gateway