Page 1 of 1

[SOLVED] Wireless problem: download to Pi fast, upload slow

Posted: Tue Nov 19, 2013 4:43 pm
by caerandir
Hi all,

I have a Netgear WG111v3 Wireless networking USB-stick (Realtek RTL8187B chipset) attached to my Pi. This worked out of the box, no problems setting up and getting up and running. Download of any stuff to the Pi is pretty fast, as one would expect. However, pulling things from the Pi, like file transfer using SCP, is unbearably slow! Even the SSH to the system has time lagged output, like if I do dmesg the pages are coming with visible short "hickups". Using wired network is absolutely fine.
Things that show the problem are WinSCP, scp from another Raspberry, Putty. scp transfer rates are around 10 KB/s! Download to the Pi is of the order 1 MB/s+...
I already searched the internet and tried changing the wireless channel and switching of QoS. No changes. dmesg shows nothing suspicious, the iw-tools also look perfect (except for a number of excessive Tx retries, but the count is too low to account for the problem). As an example, here the output of iwconfig (the USB-stick is now lying in 1m distance from the AP, hence the strong signal):

Code: Select all

wlan0     IEEE 802.11bg  ESSID:"MyWLAN"
          Mode:Managed  Frequency:2.447 GHz  Access Point: <AP-MAC>
          Bit Rate=54 Mb/s   Tx-Power=20 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-7 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:24  Invalid misc:6   Missed beacon:0
Any idea what is wrong?

Thanks!

Caerandir

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Sat Nov 23, 2013 10:00 pm
by caerandir
Update: I tried a different WLAN-Router, but the symptoms are exactly the same. Does anyone have an idea what might be wrong or how to get more information from the system?

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Sat Nov 23, 2013 11:11 pm
by hal8000
There's probably nothing wrong, its just because you are using wireless.
Your 802.11G has a maximum physical layer speed of 54Mbps.
However you will have a security layer (WEP, WPA2), bandwidth reserved
for control frames and error correction, and possibility that some data may be
distorted due to noise or interference, all amount to a much slower real
throughput values.
Wifi streams are asymmetrical, so upload is likely to be one tenth
of your download.

Also, as you're using windows, then transfers will be taking place
via samba and this all reduces your bandwidth.

The best solution is to use ethernet between your RPi and router,
you can then utilize the full 100Mpbs bandwidth of your LAN.

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Sun Nov 24, 2013 1:09 pm
by caerandir
Thanks for the input!

I think I can rule out any of your points however. The same USB Wifi Stick works much faster on a windows machine. And - although i am pretty sure that wireless lan is symmetric, i.e. max. 54 MBps in each direction - The difference between up- and download is more of a factor 100 rather than 10 (like e.g. typical DSL). If I calculate what I would expect (and what I see on a windows machine - I just tried it on a Windows laptop to be sure that the stick has no problem) it would be - including protocol overhead - something of the order 3-4 MByte/s (54 Mbps devided by 10 bit per byte = 5.4 MByte/s minus some allowance for inefficiency). As compared to 10 KByte/s that I see. Another thing is, that the LED of the WLAN-Stick flashes rapidliy when sending something to the Raspberry, where I get expected speeds. In the other direction the LED flashes lazily, as if the Raspberry sends out data very slowly with rather long intervals of "silence" inbetween.

Regarding Windows: I do not use SMB/samba. I tried SCP and SFTP, and also SSH shell shows lag. SMB is not involved at all. And I tried scp between two Raspberries, so no Windows involved.

I agree that cable LAN is better (more reliable, faster etc.), but this is not an option. The planned place where the Raspberry in question is to be used can not be reached by cable - at least not in a reasonable way. So I need Wifi, and I need at least 1 MByte/s.

I think there is some systematic problem, but I have no idea how to tackle it. Are there any logs one could generate? Help appreciated!

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Sun Nov 24, 2013 2:38 pm
by caerandir
Another update: I just tried the same Raspberry and the same stick using the most recent Arch Linux - works like a charm! 800 KByte/s just "out of the box".

Help needed: Can I simply copy the kernel modules from Arch Linux to Raspbian?

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Sun Nov 24, 2013 9:57 pm
by caerandir
Hi all,

I think I could pin things down quite a bit. I downloaded the official latest version of Raspbian and - lo and behold - everything works fine. I did apt-get update/upgrade, still fine. I did rpi-update: Crash! Slow rates are back. Obviously some module - most likely rtl8187.ko - went broken in some update.

What I have no idea about: How to fix it? I guess I cant simply copy the old .ko to the updated OS - I think the kernel changed and it would not work - am I right?

Any help appreciated!

Thanks

Caerandir

EDIT:

The modinfo for rtl8187.ko from Archlinux - Working:

Code: Select all

filename:       rtl8187.ko
license:        GPL
description:    RTL8187/RTL8187B USB wireless driver
author:         Larry Finger <[email protected]>
author:         Hin-Tak Leung <[email protected]>
author:         Herton Ronaldo Krzesinski <[email protected]>
author:         Andrea Merello <[email protected]>
author:         Michael Wu <[email protected]>
srcversion:     B7A64080945C5E092134248
[...]
depends:        mac80211,eeprom_93cx6,led-class,cfg80211
intree:         Y
vermagic:       3.6.11-14-ARCH+ preempt mod_unload modversions ARMv6
The modinfo for the untouched Raspbian:

Code: Select all

filename:       //./lib/modules/3.6.11+/kernel/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
license:        GPL
description:    RTL8187/RTL8187B USB wireless driver
author:         Larry Finger <[email protected]>
author:         Hin-Tak Leung <[email protected]>
author:         Herton Ronaldo Krzesinski <[email protected]>
author:         Andrea Merello <[email protected]>
author:         Michael Wu <[email protected]>
srcversion:     B7A64080945C5E092134248
[...]
depends:        mac80211,eeprom_93cx6,led-class,cfg80211
intree:         Y
vermagic:       3.6.11+ preempt mod_unload modversions ARMv6
And same after rpi-update:

Code: Select all

filename:       /lib/modules/3.10.18+/kernel/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
license:        GPL
description:    RTL8187/RTL8187B USB wireless driver
author:         Larry Finger <[email protected]>
author:         Hin-Tak Leung <[email protected]>
author:         Herton Ronaldo Krzesinski <[email protected]>
author:         Andrea Merello <[email protected]>
author:         Michael Wu <[email protected]>
srcversion:     AF412C44DACDC2D28C5DF42
[...]
depends:        mac80211,eeprom_93cx6,led-class,cfg80211
intree:         Y
vermagic:       3.10.18+ preempt mod_unload modversions ARMv6

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Mon Nov 25, 2013 6:30 pm
by hal8000
Can you post output of

cat /etc/fstab

from Raspian.
Quite often the noatime option in fstab can speed up disk access.
If this was not set when you used Arch then it will make no difference
on Rasbian.
If you can work on Arch, do you need Rasbian? Sometimes packages
are available on both distributions.

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Tue Nov 26, 2013 12:31 pm
by caerandir
Hi hal8000,

thanks for the input. I will check for noatime this evening (Currently no access to the Pi). However, I did not observe any problems with the disk access speed, and surely the disk access speed is more than sufficient to privide for more than 10 KB/s.

Did you see my last post? For me it seems now that at some point during the firmware updates something broke the module for the Wifi-chip I use. I had hoped that someone from the team managing the firmware (Hexxeh?) would answer my post.

As to your last question: I could in principle use Arch, but honestly I am now fairly used to Raspbian and did quite some customizing which I would need to do from scratch. I am not very keen on doing this. And I think it will help everyone if the error is fixed in Raspbian.

Cheers, Caerandir

Re: Wireless problem: download to Pi fast, upload from Pi sl

Posted: Tue Nov 26, 2013 8:58 pm
by caerandir
Arch Linux has no noatime option neither in fstab nor mtab. Raspian on the other hand has the option set for the ext4 filesystem.

[SOLVED] Wireless problem: download to Pi fast, upload slow

Posted: Sun Dec 15, 2013 1:04 pm
by caerandir
Most recent updates solved the problem (3.10.23+ #608 PREEMPT). Thanks!

Re: [SOLVED] Wireless problem: download to Pi fast, upload s

Posted: Sun Oct 26, 2014 8:49 pm
by Redsandro
I have a similar problem where download is ~600KB/s and upload is ~50KB/s.
I updated from #600 to #675 (but cannot go any higher because it breaks the camera module)

Can I install the module separately from some source to check it out?

Code: Select all

$ readlink /sys/class/net/wlan0/device/driver
../../../../../../../bus/usb/drivers/rtl8192cu

Code: Select all

$ lsusb | grep -i rtl
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

Code: Select all

$ iwconfig
wlan0     IEEE 802.11bgn  ESSID:"REDnet8K"  Nickname:"<[email protected]>"
          Mode:Managed  Frequency:2.457 GHz  Access Point: **:**:**:**:**:**   
          Bit Rate:72.2 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=88/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.

Re: [SOLVED] Wireless problem: download to Pi fast, upload s

Posted: Tue Oct 28, 2014 2:33 pm
by caerandir
May I ask what you mean by "breaks the camera module"?

Asking Google for your chipset "RTL8188CUS" I find many posts that claim successful operation on Raspberry, even as an access point. So my first guess would be something not related to the OS. Have you ever checked if you are using a crowded WiFi-channel? Shiftig to a different channel might help. Other thing to check: How does the adapter perform on a different system?

Re: [SOLVED] Wireless problem: download to Pi fast, upload s

Posted: Tue Oct 28, 2014 3:01 pm
by Redsandro
caerandir wrote:May I ask what you mean by "breaks the camera module"?
http://www.raspberrypi.org/forums/viewt ... 88#p631788
Asking Google for your chipset "RTL8188CUS" I find many posts that claim successful operation on Raspberry, even as an access point.
True, I read that too, although there are also many different adapters that have that specific chipset, all reported yielding very different results. As for the access point, you need to use the nl80211 driver but I have no clue nor can I find a tutorial on how to switch rtl8192cu with nl80211 for testing purposes (without setting up an actual AP).

See http://elinux.org/RPi_USB_Wi-Fi_Adapters
So my first guess would be something not related to the OS. Have you ever checked if you are using a crowded WiFi-channel? Shiftig to a different channel might help. Other thing to check: How does the adapter perform on a different system?
Not sure, but let's just say all my other devices work perfectly over WIFI. (laptop, desktop, phone, two tablets, android-based media player). Unfortunately, I cannot properly get the USB device to work in my laptop to test it out. After reconnecting to the wifi for 10 times, it works for a minute and is slow. It sais it is connected at 7.2 mbit. There is clearly something wrong. But it doesn't make sense to test this because my laptop is also debian based. Big chance they (laptop + pi) share the same problem (if there is one).

Re: [SOLVED] Wireless problem: download to Pi fast, upload s

Posted: Tue Oct 28, 2014 8:42 pm
by Redsandro
I found out that using an powered USB hub causes the upload speed to be fast(er).

This puzzles me, because I am using a 2A power supply for the Pi specifically for this reason. The Pi, without the Wifi module, works fine with a 0.5A power supply. So the supply seems more than enough.

It is as if the Pi limits the maximum amount of milliamps on the output. Sounds reasonable, I just didn't know that.

However, when I remove the power supply to the Pi, the Pi keeps working! Just because the USB port is now connected to the powered USB hub. Logic dictates that the USB power connectors for the micro-usb power input and the two other USB ports are literally connected, hence there could be no limiter on the line. I am confused.

This is good news - the Wifi dongle works perfectly, with a little bit more power. But I cannot fit all that stuff in the camera casing. It's slightly disappointing that I need a big HUB and extra power just for that dongle that is like 6 x 6 x 16 millimeters in size.

So what is the smallest (and cheapest) possible way to add extra power to the dongle?

Can I use a non-powered HUB and power it by plugging a powered USB connector in one of the ports, so that both the WIFI USB dongle and the Pi are powered?

Re: [SOLVED] Wireless problem: download to Pi fast, upload s

Posted: Tue Oct 28, 2014 10:13 pm
by caerandir
OK, power is the problem - there is a very good article about power problems with the Raspberry, covering the different models/versions and their issues:
http://elinux.org/RPi_Hardware#Power
Since I suffered from the polyfuse problem with my oldest Raspberry, I decided to feed in Power not over Micro USB, but over the full sized USB port. This is a little bit risky, since the polyfuse on the MicroUSB is no longer in effect, but it solved many of my problems. So if you have one free USB port on the Raspberry, just feed in power there and attach the WiFi-Dongle to the other. I experienced ripples in the camera image when doing so, but they went away when I attached poer to both MicroUSB and full size USB. Alternatively, you might feed in 5V over the according GPIO pins, which I heard some users to do, but never tried myself. But in any case, be aware of the missing fuse, so any short circuit may fry your Pi.

Re: [SOLVED] Wireless problem: download to Pi fast, upload s

Posted: Tue Oct 28, 2014 11:32 pm
by Redsandro
thank you, that link is very informative.