WiFly (RN-XV) Wake Duration Issue

I’m trying to configure a WiFly (RN-XV) to wake up every 10 minutes, connect to my WLAN, report values from 2 analog inputs to my server and go back to sleep. I’ve read in the data sheets for similar products, such as the RN-131 that they are capable of performing these operations in less than 100ms (http://www.microchip.com/wwwproducts/De … e=en558369). I can’t get mine to perform them in less than about 17 seconds. The RN-XV is based on a different chip (the RN-171), but I would still assume the performance would be similar, or at least within an order of magnitude.

In my testing, the WiFly sleeps for the correct amount of time. Once it wakes up, the green LED comes on and the serial output almost immediately shows:

MAC Addr=00:06:66:72:44:0b

Auto-Assoc chan=1 mode=WPA2 SCAN OK

Joining now…

READY

Disconn from ,2:8

Auto-Assoc chan=1 mode=WPA2 SCAN OK

Joining now…

Associated!

Using Static IP

Listen on 2000

OPEN

After it connects, it waits about 10 seconds, then the amber LED blinks once or twice (this is when my Apache log first shows activity). Then the serial output shows

HTTP/1.1 200 OK

Date: Thu, 24 Jan 2013 01:23:01 GMT

Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8r DAV/2 PHP/5.4.4

X-Powered-By: PHP/5.4.4

Content-Length: 3

Connection: close

Content-Type: text/html

CLOS

all at once. After sending data, it stays awake for another, about, 7 seconds with the green LED blinking at about 1Hz, but no other apparent activity before going back to sleep.

I have tried reducing the duration of the idle timer (the time with no transmit or receive activity before the connection is closed), but when I have it much less than it is now, the WiFly disconnects and goes to sleep before it sends data to the server.

My current WiFly settings are:

wlan phrase xxxx

wlan ssid

ip address 192.168.1.30

ip dhcp 0

ip host 192.168.1.29

ip remote 8888

ip proto 18

com remote GET$/thepage2.php?DATA=

q sensor 0x0C

option format 7

sys autoconn 1

com idle 10

sys sleep 10

wan rate 3

wan tx 6

The WiFly is connecting to a Netgear 802.11 b/g/n access point (WN802T) using WPA2 then to my local Apache server running on an iMac.

I have read the RN-XV manual over and over, searched online for hours with no resolution found. I can’t figure out why the WiFly is waiting so long after it connects to send data, then so long to go back to sleep. Can anyone point me in the right direction to have my WiFly awake for a shorter duration?

Is anyone using the RN-XV to periodically wake up and post data? If so, could you share some of your settings and observations of timing?

I am doing something similar except that I am broadcasting a UDP message rather than posting. Like you I was expecting less time for the RN-XV to get things done.

To try to figure out what is going on I instrumented the code to measure time from wake (assert CTS high) to awake (RTS low) to associated (GPIO4 high) and back to sleep (RTS high). I then collected data from 10,000 samples. The Arduino samples the sensors and sends a message every 10 seconds. Each message is about 50 bytes transfered to the RN-XV at 9600 baud.

  • Wake to Awake is 36 milliseconds (mS) for 83.7% of the samples

– 97.3% of the samples take less than 200 mS

– 2.7% fall through my timeout at 200 mS

  • Associate time is more spread out

– 57.1% of the samples associate within a second

– 84.3% of the samples associate within 1.5 seconds

– 98.5% of the samples associate within 4.7 seconds

– the remaining 1.5% of the samples fall through my 5 second timeout

---- these always result in the UDP message not being received

  • back to sleep is the time from the last character sent to when RTS goes high

– 69.1 % of the samples go back to sleep within 600 mS

– 99.97% of the samples go back to sleep within 650 mS

– 3 samples appeared to never go back to sleep before the next cycle

  • Total awake time is less than 2.7 seconds for 90.4% of the samples

– 98.0% are less than 4.3 seconds

If I can find somewhere to post them I will supply the histograms for the data.

Note that although the percentages are similar there is little correlation between the awake timeout and the associate timeout. Out of 155 samples that hit the associate timout only 5 also hit the awake timeout.

Setup for the RN-XV is as follows.

set opt deviceid WeatherStation

set wlan phrase

set wlan ssid

set ip protocol 1

set ip host 192.168.1.255

set ip localport 20130

set ip remote 20130

set comm time 100

set sys autosleep 3

set sys iofunc 0x70

set sys trig 2

save

reboot

I would be very interested in any advice or even speculation as to how to reduce the awake time.

Thanks.

I found that I was able to cut my time after sending data before going back to sleep to almost nothing by reducing the sleep time (set sys sleep 2). However, I still have the long delay after connecting before sending data. I also noticed that during this time (after connecting, before sending data) I am unable to telnet to the wifly. I immediately get “Connection closed by foreign host”. I don’t know if that is meaningful. It says it is listening at this time. It has output “Listen on 2000 OPEN” on the serial lines. I can’t figure out why it is waiting to send data.

I think you should try this…

I’ve done this … I had mine sleep for 10 minutes, post and go to sleep.

set sys wake 10

set sys sleep 1

This tells the unit to “wake” every 10 seconds and post data to your server, then go to sleep 1 second later.

I had mine set to post data on the wake operation. ( See sec 10.1 of WiFly UM ) I think your is waking posting

then waiting for the idle time 10 seconds to expire.