Edimax Wifi adapter seems to go to sleep if not used (solved


38 posts   Page 1 of 2   1, 2
by AforAlex » Sun Nov 24, 2013 4:30 pm
Hi,

Still trying to get to the bottom of this one, but it appears that the WiFi adapter keeps on 'going to sleep' if its not getting any traffic.

Typical behaviour would be switch on the Pi, using the Edimax wifi adapter, no lan connection. All is well and I SSH onto the Pi, it then seems that as long as I am doing something in the SSH screen then everything is fine, but as soon as I stop doing anything on the PI and come back then it takes about 30 seconds for the system to start back up again.

Just to be clear, the SSH connection hasn't been dropped, the pi is still active and functional (if I log into it directly then its still functioning), but in the SSH session whatever I type doesn't appear ..... until about 10-30 seconds later it all springs back to life.

I'm using a original model B Pi, with latest updates applied.

Any thoughts on what could be going on here would be very much appreciated, seems to me that there is some kind of wifi/Edimax power saving that's kicking in .... could this be right??

Thanks in advanced
Posts: 82
Joined: Thu May 31, 2012 7:56 pm
by MrEngman » Sun Nov 24, 2013 5:47 pm
Try this. Make a file 8192cu.conf in directory /etc/modprobe.d/ with the command
Code: Select all
sudo nano /etc/modprobe.d/8192cu.conf

and add the following lines
Code: Select all
# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I'm assuming you are using the Edimax EW-7811Un


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.
Posts: 3373
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by AforAlex » Sun Nov 24, 2013 7:04 pm
Hi many thanks, yes its the Edimax EW-7811Un, never in a million years would I have thought of looking there and creating a file with those settings so much appreciated
Posts: 82
Joined: Thu May 31, 2012 7:56 pm
by texy » Thu Jan 02, 2014 8:04 pm
MrEngman wrote:Try this. Make a file 8192cu.conf in directory /etc/modprobe.d/ with the command
Code: Select all
sudo nano /etc/modprobe.d/8192cu.conf

and add the following lines
Code: Select all
# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I'm assuming you are using the Edimax EW-7811Un


MrEngman

Many thanks for this MrEngman. I have had this same problem for some time now and couldn't work out what was wrong. The above change has also fixed the problem for me.
The question is why it has suddenly started to be a problem? I,ve been using the Edimax wifi dongle for over 18 months now and its been very reliable. Something has clearly changed in the code. Although this is a full workaround, I,d rather it not happen in the first place.

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Forum Moderator
Forum Moderator
Posts: 4922
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by MrEngman » Thu Jan 02, 2014 8:34 pm
Hi Texy,

Glad to be some help. I came across this suggestion in a post on the forum quite a long time ago.

I've no idea why it works, other than it interacts directly with the driver, but there appear to be some oddities regarding so called power management. Command iwconfig always shows power management is off regardless. But the 8192cu driver for the EW7811Un is compiled by default with minimum power management enabled, and appears unaffected by the general power management setting, so could drop power after some time but shouldn't turn off, and this is even when power management is reportedly turned off. It could be the distance to the AP may come in to it and when power is reduced the connection could be lost. Just a guess though.

I can run my Pi's without the 8192cu.conf file and I generally don't have a problem, although I normally have the 8192cu.conf file set up regardless. Similarly for devices using the 8188eu driver a 8188eu.conf file with similar contents will keep that one working as well.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.
Posts: 3373
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by jhamlin » Sat Feb 08, 2014 11:52 pm
Thanks so much for this fix!!

Working great for me now too.
Posts: 1
Joined: Sat Feb 08, 2014 11:47 pm
by dl2mic » Mon Feb 17, 2014 9:34 pm
Hi All,

many thanks for all the suggestions to solve this issue.
Unfortunately none of them solved my problem.

My Router is powered off for some time.
The Pi looses its Wifi connection. I think that the Pi Edimax driver falls into deep sleep if the Router is off for too long. The same could be if the Link is not stable for a longer time.

Power On the Router restarts all devices but the Pi.

Ping does not work as there is no Router and later the Device is obviously in deep sleep.

I solved this my way:

Code: Select all
#!/bin/bash
# check if a wlan0 if exists
if echo `/sbin/ifconfig` | grep -q $1; then
#check if there is IP Address
  if echo `/sbin/ifconfig $1` | grep -q "inet Adresse"; then
    exit 0
  fi
  /sbin/modprobe -r 8192cu
fi
/sbin/modprobe 8192cu
exit 0


$1 is wlan0

This script is executed every Minute by cronjob as root.

Maybe there are better ways. But it works for me.

A.
Posts: 1
Joined: Mon Feb 17, 2014 9:03 pm
by czhanacek » Thu Jun 19, 2014 5:17 pm
Thank you so much MrEngman! I've been having the same problem for a while now, and this is such a necessary step for having a hard-to-access Pi like mine. Now I don't have to run outside and reboot the thing to tweak it.
Posts: 2
Joined: Thu Jan 24, 2013 1:13 am
by Hasse.Nielsen » Fri Jul 11, 2014 3:34 pm
Hi,
I'm having the same kind of problems with a Pi model B and a Edimax micro.
My Pi is mounted on the roof and its pretty annoying to have to flick the power once or twice a day.

Would anyone like to join forces on development of a preconfigured disk image that focus on stability and unattended remote placement?

Kind regards
Hasse
Posts: 5
Joined: Fri Jul 11, 2014 3:20 pm
by whowantspi » Fri Sep 12, 2014 1:47 am
Thanks for posting this. I just found this fix after fighting this problem for many months. Somewhere along the way some code or driver changed because all four of my wireless adapters worked fine for six months before I started having problems. Thanks again.

MrEngman wrote:Try this. Make a file 8192cu.conf in directory /etc/modprobe.d/ with the command
Code: Select all
sudo nano /etc/modprobe.d/8192cu.conf

and add the following lines
Code: Select all
# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I'm assuming you are using the Edimax EW-7811Un


MrEngman
Posts: 30
Joined: Mon Feb 11, 2013 12:00 am
Location: USA Alabama
by vjoco » Tue Oct 07, 2014 5:37 pm
Upgrading to Raspberry Pi B+ model, using a new Raspbian image, I began to experience instabilities in wlan0 functionality. I try the 8192cu.conf method. I will post here the results!
Posts: 2
Joined: Tue Oct 07, 2014 5:33 pm
by vjoco » Sat Oct 11, 2014 5:31 am
IT IS WORKING!

sudo nano /etc/modprobe.d/8192cu.conf

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
Posts: 2
Joined: Tue Oct 07, 2014 5:33 pm
by RolfBly » Fri Oct 24, 2014 3:02 pm
Here is some documentation about the power settings.

Adafruit have a slightly different solution, with rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1.

(Edit 27-10). This also works, But! The documentation says:
In PS mode, you can turn on or turn off the USB autosuspend functionality
. From this, I deduce that enusbss=1 is ignored if rtw_power_mgnt=0, since this disables PS mode. In other words, if you want to just disable power save mode, all you'd need to do is

Code: Select all
# Disable power management
options 8192cu rtw_power_mgnt=0
Last edited by RolfBly on Mon Oct 27, 2014 10:40 am, edited 3 times in total.
Posts: 19
Joined: Mon Jul 16, 2012 7:07 pm
by DougieLawson » Fri Oct 24, 2014 3:25 pm
There's four parms listed in the document you cite.
Code: Select all
rtw_power_mgnt=0|1|2
  • 0 == disable power saving
  • 1 == power saving on, minPS
  • 2 == power saving on, maxPS
Code: Select all
rtw_enusbss=0|1
  • 0 == disable auto suspend
  • 1 == enable auto suspend
Code: Select all
rtw_hwpwrp_detect=0|1
  • 0 == disable HW power pin detection
  • 1 == enable HW power pin detection
Code: Select all
rtw_ips_mode=0|1
  • 0 == low power, IPS_NORMAL
  • 1 == higher power, IPS_LEVEL2

The conventional wisdom, because we're running our RPis as server systems not clients, is to set rtw_power_mgnt=0 and rtw_enusbss=0 to prevent the dongle going into power saving and to ignore the other two parms because they don't make any difference. If the server goes into power saving we'd need a process to wake it up. That's different from a client system where interaction from a keyboard user will trigger a request to wake up and associate the dongle.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.
User avatar
Posts: 27604
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by ds00424 » Tue Nov 18, 2014 4:14 pm
@DougieLawson
Good Q.
I do see in the doc:
"In PS mode, you can turn on or turn off the USB autosuspend functionality by adding the following parameter"

Could it be that if NOT in PS mode that autosuspend is off - no matter what the setting?
Have you tried "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0 rtw_ips_mode=1"
And if so, with what success? Curious minds what to know :-)

I have several remote RPis and once in a while the wifi drops on one or another - making me go visit it. Maybe it's lonely, but I would rather not have to make the drive.

On my dev system I was having ssh drop offs after about 30 sec idle. Sometimes it would drop the ssh and sometimes it would take 10 seconds to show characters. The original suggested fix looks like it has made this problem go away (so far after a few mins).

Just tried "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0 rtw_ips_mode=1" and it also seems to have fixed my ssh dropoffs.

I am going to see how it works in the field over a few weeks...
Will report back.
Posts: 5
Joined: Mon Oct 21, 2013 2:19 pm
by EricFlagstaffAZ » Sun Nov 23, 2014 4:42 pm
Many thanks for providing the power management fix using the update to the 8192cu.conf file.
I can confirm that it solved my problem with both the Edimax EW-7811Un as well as the NETIS WF2123 Wireless USB Adapters.
Posts: 4
Joined: Sun Nov 23, 2014 4:31 pm
by ds00424 » Sat Dec 20, 2014 1:18 am
I have had this fix applied to 9 remote RPis. Prior to this fix, over the past year, various ones have dropped of their local wifi. Not sure why -- perhaps weaker wifi? Usually at the rate of one or two a month. With this fix I have only had two drop offs in the last month and each of those can be attributed to service provider failures. So far so good (knock on wood). Thanks again.
Posts: 5
Joined: Mon Oct 21, 2013 2:19 pm
by hdtodd » Mon Dec 22, 2014 4:16 am
I've been struggling with intermittent loss of SSH connections from Mac to Pi for a couple of months, but persistent in the last week or two. I'll add my thanks to MrEngman to those of other posters. To my surprise, this was the solution. Others reporting similar problems found that their problems were caused by conflicting IP addresses, short timeouts on DHCP leases, or other factors -- I tinkered with a bunch of them to no avail. This modprobe addition fixed it.

A contributing confusion was that this was intermittent, but occurrences increased substantially recently. That was because I had earlier been using another brand of WiFi dongle, besides one Edimax on a rarely-used Pi, and I recently added a second Edimax when I added yet another Pi, and I've been using primarily that new Edimax. Didn't connect the dots 'til I saw MrEngman's post.

I'm titling the subject of this post in a way that I looked for solutions in hopes that it'll help someone else find their solution more quickly.

THANKS!
Posts: 8
Joined: Tue Mar 04, 2014 1:53 am
by Loonhaunt » Mon Dec 22, 2014 12:33 pm
Ditto,

This was more of a problem with the B+ than previous versions.

DB
Posts: 51
Joined: Sat Nov 16, 2013 5:13 am
by AlessandroFerri » Sat Feb 07, 2015 9:45 am
hello everyone,
I find the instructions very interesting. I solved a lot of doubts. I am left with a very big doubt.
I have two wifi doungle: the first is a Edimax EW-7811Un, the transmission data rate can go up to 150Mbps, and a D-Link DWA-131 Wireless speeds of up to 150 Mbps (Transmit) and 300 Mbps (Receive) according to manufacturers' specifications. I use my raspberry with shairport on my home network, with other devices Airplay. When I check the connection from my mac I see that the raspberry is connected from 58Mb/s to 72Mb/s with Edimax and 144Mb/s with the D-Link. Is there anyone who can tell me why the connection is half?
Should be about 150Mb/s for the edimax and about 300Mb/s for the D.Link.
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm
by pluggy » Sat Feb 07, 2015 1:11 pm
I long since learnt to accept that a cheap computer like the Pi is slow and the USB interface has long had issues (not so much these days, but they are still there). I just live with the lacklustre Wifi performance. Take it from me, stuff works a lot better now than it did 3 years ago. If you want top notch performance, buy a computer that costs a lot more than a Pi.

I've asked (to no avail) that this patch be incorporated into standard Raspbian, a couple of kilobytes in one file is neither here nor there with all the bloat in recent Raspdians.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
User avatar
Posts: 3636
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by AlessandroFerri » Sat Feb 07, 2015 1:21 pm
Thank You,
but this does not explain whether if it is a problem of Pi, or if it is a problem of port usb wifi setup.
Posts: 61
Joined: Tue Apr 02, 2013 5:44 pm
by pluggy » Sat Feb 07, 2015 1:45 pm
Its the Pi's limited USB interface. The SOC used in the Pi was never envisaged to be used as a USB host. My pi can't move stuff over wifi halfway near as fast as my laptop.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
User avatar
Posts: 3636
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by spatieman » Thu Mar 12, 2015 10:59 am
A friend has the new model B++ (quad core) ,he has the same isue when we tested it yesterday.
think he wil be happy with this.
Posts: 10
Joined: Tue Jan 13, 2015 10:06 am
by wbjapcow » Tue Jun 16, 2015 4:01 am
I had this problem with my EDUP EP-N8508GS WiFi dongle as well. Not surprising I guess - it has a similar chipset.

The other suggestions did help.

Had to create this file

/etc/modprobe.d/8192cu.conf

and edit as suggested in this post

Wondering if this turns of power management on other things I might rather keep on.

-wbjapcow
Posts: 1
Joined: Tue Jun 16, 2015 3:44 am