Download WiFly Serial Adapter User Manual
Transcript
DWRN171-XX User Manual For example, if you want the module to wake up, join a network, and be available to accept TCP connections for 30 seconds every 2 minutes you would set the timers as shown in the following example: set wlan ssid my_net set wlan passphrase my_pass set sys sleep 30 set sys wake 90 save reboot // Set the host name // Set the passphrase // The module sleeps after being awake for 30 s // The module wakes after sleeping for 90 s // Save the settings // Reboot Figure 7 shows the transitions between the sleep and awake state based on the sleep and wake timer settings in the previous example. Figure 7. Sleep & Awake State Transitions UDP Sleep & Connection Timers In UDP only protocol mode (set with the set ip proto 1 command), the autoconn timer is used as an auto-sleep timer. When the module begins to transmit the first UDP data packet, this timer begins counting down. When it reaches 0, the module sleeps. You set the UDP auto-sleep timer using two commands, set sys autosleep and set comm timer. The timer interval is a product of the autosleep value and the comm flush timer (in ms). The timer is decremented every “product” milliseconds. For example, if you want a UDP sleep timer of 40 ms, use the following commands: set sys autosleep 4 set comm timer 10 // Set the auto-sleep value to 4 // Set the comm timer to 10 ms (default value) The resulting UDP sleep timer is 4 x 10 ms or 40 ms. You could also set autosleep = 2 and comm timer = 20 ms to achieve the same effect. datasphere recommends using a minimum value of 2 (when the default flush time is 10 ms) to ensure that the UDP packet is transmitted. For larger packets, you should increase the value. TCP Connection Timers The TCP connection timers control when the module opens or closes a socket. Opening a TCP Connection In TCP client mode, the auto-conn timer controls the establishment of a socket connection. When set, the device periodically attempts to establish a connection when the timer expires. The set sys autoconn <value> command causes the module to connect to the host periodically. The timer <value> determines how often to connect to the stored remote host. If set to 1, the module makes one attempt to auto connect upon power up. If set to 2 or higher, auto connect re-opens the connection after the connection is closed. The default, 0, disables the timer. NOTE: You must specify the remote host’s IP address and port number in the module’s configuration file for the autoconnect timer to work. DW-RN171-XX User Manual Revision 1.1 Printed in Germany by datasphere wireless - Systems & Solutions GmbH . All rights reserved. www.datasphere.eu - [email protected] - 40 -