6

before voting this question down or closing it i know there are allready answers on this here but they do not work for me. I have a Raspberry B+ with wheezy lates version and a Usb WiFi Dongle :

Ralink Technology, Corp. RT5370 Wireless Adapter

What I want is to connect to my pi at any time from my windows pc with putty. The Problem I have is I can only connect directly after a reboot and after not typing for 1 Minute or so the connection is lost and I can not reconnect unless I restart my pi.

  • Well we will give you time to amend your question and add what you tried in detail. You would not want us to waste our time by suggesting something you have tried but did not work. – joan Aug 26 '15 at 14:56
  • thats true I tried the popular SE Answer but still the same and I tried iwconfig wireless-power off and I tried find anything out what driver my Dongle uses but I have no idea – Zion Aug 26 '15 at 15:05
  • 1
    Type "rt5370 raspberry pi" into google, you're not the first one to have the problem. Actually I had this problem, the solution was to update the hardware driver. Also you say latest version of wheezy put have u updated and upgraded your packages using apt-get? – Tyson Aug 27 '15 at 15:48
7

Clarifications first

Did you try to keep a ping command running on the Raspberry (ping your router IP for example)? Does it stop after awhile? Or does it work but you can't connect to SSH somehow?

Disable WiFi power saving

Are you using power saving mode on the WiFi dongle? Check it:

$ iw wlan0 get power_save
Power save: on

If it is ON, perhaps try to set it to OFF: iw wlan0 set power_save off.

To make this change persistent, if you are using NetworkManager you can follow this gist to disable WiFi power saving. If you are not using NetworkManager, on Raspbian/Debian you can edit the file /etc/network/interfaces and add a post-up entry for your interface, example:

iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  post-up iw wlan0 set power_save off

Check the power supply

As I said in a comment, try to put your USB WiFi dongle on a external USB hub with its own power. It is possible that for example when the USB dongle needs to increase the Tx Power of the transmission because of for exemple some more noise in your radio environment, the RPi can't give enough power and the USB dongle behaviour can be undefined (e.g. it is turned off). You could also use a more powerful USB power supply for your RPi. What is the power of yours? Can it deliver up to 2A at 5V? (check on the power supply itself, it is often written in really small).

Check your logs

Check your system logs (e.g. /var/log/messages) does it tell you about some problems related to your WiFi hardware or about the network?

Check your hardware

When you start the RPi and that you have WiFi working, do you see the USB dongle in the list reported by lsusb -v? And after you lost the wifi, is it still listed by the same command?

Check the connection info

When you have the WiFi up and running, what are the output of iw wlan0 link and iw wlan0 station dump?
Then once the wifi is lost, what are the output of both commands?

And once you have lost wifi, are you still able to view your wifi network?

$ sudo iw wlan0 scan | less

Run the above on your RPi when it has lost the connection, and see in the output (might take several seconds to be displayed) if there is your wifi network name.

  • 2
    Just wanted to add a note here to say that this basically answered the problem for me on a freshly installed Pi Zero. Except that at first, iw wlan0 get power_save was giving me an error. But after I did sudo apt-get update && apt-get upgrade and rebooted, it did tell me that power_save was indeed turned on. So, I did sudo iw wlan0 set power_save off, and now I can still ssh into my Pi after it's been idle. – Dougal Campbell Oct 7 '16 at 19:06
1

It doesn't really make sense that this is some kind of intentional "sleep" mode. What is the point of a wifi adapter that cuts out after a minute or two?

In other words, I do not think your problem is caused by such a feature, so trying to disable it will not help. I have an adapter with this exact same chip that I use without problems on the pi, by the way.

You need to make make sure the pi is keeping the correct time (look at the output of date), then allow this to happen and look through /var/log/syslog afterward; the messages in there are timestamped. Look and see if there is any explanation. If the adapter really were putting itself to sleep, I think there would be an indication. If the adapter doesn't have a light in it to indicate whether it is working, it may actually be something unrelated.

  • I agree with you. Perhaps the power adapter the person asking the question is using does not deliver enough indeed power (A) for the RPi, the dongle and whatever else is plugged to it. A recommendation would be to use a more powerful power adapter or to use a USB hub with a dedicated power supply. – Huygens Aug 26 '15 at 15:43
  • 1
    This is true. For a B+ and a wifi dongle you probably want >= 1.2 A. You might also try setting max_usb_current=1 in /boot/config.txt. – goldilocks Aug 26 '15 at 15:47
  • 1
    And if you are unlucky enough to have a tombstoned cap next to the USB clock crystal, you might see a working USB connection the first x (with x anywhere between 10 to 120) seconds, after which networking and USB totally fails. I know from experience how difficult it is to troubleshoot this, until you inspect the (underside of) the board. This was on a B (not B+) though. – Phil B. Aug 26 '15 at 19:06
  • I measured the Power the pi uses its max was 0.55 A – Zion Aug 27 '15 at 8:05
  • Okay, and a wifi dongle might draw up to another 0.5 A at peak. A reasonable person will recognize you should have some headroom. The people who make the pi recommend dedicating 700 mA to it. However, if you are the expert, feel free to ignore everyone else... – goldilocks Aug 27 '15 at 14:27
0

I tried running /sbin/ifup wlan0 and it worked. I got the connect:Network is unreachable error when I tried downloading packages. Found the fix here: "connect: Network is unreachable" on a working (connected) wlan0 interface

0

On some other dongles, there are parameters of the module (8192cu) set on by default and requiring the creation of a file in /etc/modprobe.d/. Your problem wouldn't be likewise?

I don't know if this is a standard but I've had to create (thanks lsmod) a module_name.conf in there with

options `module_name` rtw_power_mgnt=0 rtw_enusbss=0

to force them to sleep==0.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.