Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Miniature Wifi module seems slow

by cyclicredundancy on Fri Apr 26, 2013 2:08 am

I recently purchased the Miniature Wifi (802.11b/g/n) listed here: http://www.adafruit.com/products/814
Getting it working was pretty straightforward but data transfer speeds over wifi are really really slow.
Testing speeds using wget I get close to 60KBps over wifi vs. 6+MBps over ethernet.

WIFI:
Code: Select all
~ > wget http://mirrors.arizona.edu/raspberrypi/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip
--2013-04-25 23:58:13--  http://mirrors.arizona.edu/raspberrypi/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip
Resolving mirrors.arizona.edu (mirrors.arizona.edu)... 128.196.130.55
Connecting to mirrors.arizona.edu (mirrors.arizona.edu)|128.196.130.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 493587826 (471M) [application/zip]
Saving to: `2013-02-09-wheezy-raspbian.zip.2'

 0% [                                                                     ] 92,672      58.4K/s

ETHERNET:
Code: Select all
~ > wget http://mirrors.arizona.edu/raspberrypi/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip
--2013-04-25 23:50:37--  http://mirrors.arizona.edu/raspberrypi/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip
Resolving mirrors.arizona.edu (mirrors.arizona.edu)... 128.196.130.55
Connecting to mirrors.arizona.edu (mirrors.arizona.edu)|128.196.130.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 493587826 (471M) [application/zip]
Saving to: `2013-02-09-wheezy-raspbian.zip.1'

14% [========>                                                            ] 70,965,192  6.71M/s  eta 1m 42s 


I noticed another forum thread on this, so was wondering if this could be a hardware issue:
viewtopic.php?f=50&t=38873

My netstat looks like this. Are those error counts nominal?
Code: Select all
~ > uptime
 00:03:46 up 9 min,  1 user,  load average: 0.00, 0.18, 0.18
~ > netstat -d -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0         0      0      0 0             0      0      0      0 BMU
lo        16436 0         0      0      0 0             0      0      0      0 LRU
wlan0      1500 0      1101      0   3165 0           659      0      0      0 BMRU


I tested the wifi dongle on another raspberry-pi with the same results. Is there some way to debug this further? :(
Thanks!
cyclicredundancy
 
Posts: 3
Joined: Fri Apr 26, 2013 1:31 am

Re: Miniature Wifi module seems slow

by cyclicredundancy on Fri Apr 26, 2013 2:15 am

I'm not sure if this helps, but I just tried the dongle on my windoze desktop and got abyssmal download speeds but okayish upload speeds.

Image
cyclicredundancy
 
Posts: 3
Joined: Fri Apr 26, 2013 1:31 am

Re: Miniature Wifi module seems slow

by adafruit_support_mike on Fri Apr 26, 2013 6:41 pm

cyclicredundancy wrote:My netstat looks like this. Are those error counts nominal?
Code: Select all
~ > uptime
 00:03:46 up 9 min,  1 user,  load average: 0.00, 0.18, 0.18
~ > netstat -d -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0         0      0      0 0             0      0      0      0 BMU
lo        16436 0         0      0      0 0             0      0      0      0 LRU
wlan0      1500 0      1101      0   3165 0           659      0      0      0 BMRU

It looks like your terminal settings have the column headers misaligned to the data, but no, that's not a normal connection. The '1101' value belongs under 'RX-OK' (packets received normally) and the '3165' value should be under 'RX-DRP' (dropped packets). That means your system is dropping three packets for every one it catches.. definitely not normal, though it does explain the low transmission speed.

The Raspberry Pi forum has a lot of recent discussion of this issue, but no obvious conclusions. Some people are blaming the USB stack, others are blaming drivers written for x86 architectures that haven't been optimized to work with the ARM microprocessor, others say it's a channel or signal-strength issue.

Let's start with the things you can actually do something about. How far is the RasPi from your wireless router, and what channel are you using?
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Miniature Wifi module seems slow

by tldr on Fri Apr 26, 2013 8:06 pm

sorry to butt in, but here are my results...

Code: Select all
pi@SimpleSimon ~ $ netstat -d -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0         0      0      0 0             0      0      0      0 BMU
lo        16436 0        14      0      0 0            14      0      0      0 LRU
wlan0      1500 0      1324      0   1439 0           937      0      0      0 BMRU
pi@SimpleSimon ~ $ iwlist wlan0 scan | sed -n "/Entropy/,/Channel/p"
                    ESSID:"theEntropyWorks"
                    Protocol:IEEE 802.11bg
                    Mode:Master
                    Frequency:2.447 GHz (Channel 8)
pi@SimpleSimon ~ $ iwlist wlan0 scan | sed -n "/Channel 8/p"
                    Frequency:2.447 GHz (Channel 8)
pi@SimpleSimon ~ $


thought i'd toss in a little extra data to demonstrate that i'm all alone on channel 8. and that's with 41 access points in range. my results aren't as bad as those posted above, but i do have more packets dropped than received and i sometimes have to wait what seems like close to a minute for a keystroke to be echoed in an ssh session.

oh, yeah, i'm using the thumb sized dongle, not the miniature one.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: Miniature Wifi module seems slow

by adafruit_support_mike on Sat Apr 27, 2013 11:53 am

tldr wrote:thought i'd toss in a little extra data to demonstrate that i'm all alone on channel 8. and that's with 41 access points in range.


Actually, those statements contradict each other. In the US, there are only 11 wifi channels, so if you can see 41 access points, that means there are an average of four WAPs per channel. More likely, most of them are using whatever channel was programmed into the router when it came out of the box, so you're seeing a lot of congestion on only a few channels.

IIRC, channel 8 is notorious for being flaky when there's lots of traffic in the air. Try setting your own base station to each of the other channels and see how the connection behaves.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Miniature Wifi module seems slow

by tldr on Sat Apr 27, 2013 1:01 pm

adafruit_support_mike wrote:
tldr wrote:thought i'd toss in a little extra data to demonstrate that i'm all alone on channel 8. and that's with 41 access points in range.


Actually, those statements contradict each other. In the US, there are only 11 wifi channels, so if you can see 41 access points, that means there are an average of four WAPs per channel


well, if that's not a lie or a damned lie, it must be a statistic. (33% chance, anyway)

here's a little script i wrote to get an idea of what channels are being used in my neighborhood.

Code: Select all
for foo in 1 2 3 4 5 6 7 8 9 10 11
do
  iwlist wlan0 scan | sed -n "/Channel $foo)/p"
done


here's the output

Code: Select all
 ./foo.sh
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.422 GHz (Channel 3)
                    Frequency:2.422 GHz (Channel 3)
                    Frequency:2.422 GHz (Channel 3)
                    Frequency:2.422 GHz (Channel 3)
                    Frequency:2.427 GHz (Channel 4)
                    Frequency:2.427 GHz (Channel 4)
                    Frequency:2.432 GHz (Channel 5)
                    Frequency:2.432 GHz (Channel 5)
                    Frequency:2.432 GHz (Channel 5)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.442 GHz (Channel 7)
                    Frequency:2.447 GHz (Channel 8)
                    Frequency:2.452 GHz (Channel 9)
                    Frequency:2.457 GHz (Channel 10)
                    Frequency:2.457 GHz (Channel 10)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)


3.7272727272727272... networks using each channel. well, it's a long number if not a big one. or meaningful.

lots of activity on 1, 6 and 11. nothing on 2. anywhere from 2 to 4 using channels 3, 4, 5, and 10. only one access point on each of 7, 8 and 9. the one on 8 is mine. all alone.

nonetheless, i'll see if moving it around will help.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: Miniature Wifi module seems slow

by adafruit_support_mike on Sun Apr 28, 2013 2:23 pm

Yeah, it does look like you've got channel 8 to yourself. Do try the other low-traffic channels to see if you get better results though.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Miniature Wifi module seems slow

by tldr on Sun Apr 28, 2013 3:39 pm

thought i'd let the router pick its own channel. it chose channel 1 with pretty much similar results on not one, but two pis ... slightly more packets dropped than received.

took me longer than it should have to think of it, but i decided to see how my laptop does. its got a really flaky wifi adapter that craps out completely on occasion, but it does not appear to drop any packets.

Code: Select all
 netstat -d -i
Kernel Interface table
Iface   MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0   1500   0        0      0      0      0        0      0      0      0 BMU
lo    65536   0      111      0      0      0      111      0      0      0 LRU
wlan0  1500   0    38819      0      0      0     6304      0      0      0 BMRU


it also does a better job formatting the output.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: Miniature Wifi module seems slow

by adafruit_support_mike on Sun Apr 28, 2013 6:04 pm

Hmm.. do you happen to have a powered USB hub? A laptop has more power to throw at a device than the RasPi does, but a hub would make up the difference.

I have serious doubts about it being a power issue.. I'm more inclined to think it's a problem somewhere in the RasPi's driver/USB stack.. but I'm willing to be convinced if testing shows that good power will give you a good connection.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Miniature Wifi module seems slow

by tldr on Sun Apr 28, 2013 7:04 pm

Code: Select all
netstat -d -i
Kernel Interface table
Iface       MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0         0      0      0 0             0      0      0      0 BMU
lo        16436 0       666      0      0 0           666      0      0      0 LRU
wlan0      1500 0      8695      0   9044 0          5160      0      1      0 BMRU


this one's running with the wifi module plugged in to a powered hub. the other pi is running with the wifi plugged in directly to a usb port. pretty much the same results.

(i cheated on the netstat output and stuck four spaces in front of the MTU header.)
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: Miniature Wifi module seems slow

by adafruit_support_mike on Sun Apr 28, 2013 8:57 pm

Don't worry too much about formatting.. there's a difference between the binary's definition of a tab and the TTY's definition of a tab, and getting them in sync is far more work than it's worth.

I did some more digging in the raspberrypi.org forums, and found this thread: http://www.raspberrypi.org/phpBB3/viewt ... 9&p=178366 which makes it look like a timing issue in the USB stack. If I'm reading things correctly, the OS is trying to work at the USB 2.0 speed, which leads to packet splitting when talking to a USB 1.1 device.

According to the thread, telling the kernel to use USB 1.1 rather than USB 2.0 should fix the packet loss problems. Try adding this to your /boot/cmdline.txt file:

Code: Select all
dwc_otg.speed=1
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Miniature Wifi module seems slow

by cyclicredundancy on Mon Apr 29, 2013 12:04 am

adafruit_support_mike wrote:The Raspberry Pi forum has a lot of recent discussion of this issue, but no obvious conclusions. Some people are blaming the USB stack, others are blaming drivers written for x86 architectures that haven't been optimized to work with the ARM microprocessor, others say it's a channel or signal-strength issue.

Let's start with the things you can actually do something about. How far is the RasPi from your wireless router, and what channel are you using?


While searching for other people having similar issues I had also come across one discussion on the Raspberry Pi forum with similar complains. But as far as I know my situation is worse than anyone out there. :(

I have tried using the wireless from different distances, ranging from 2 feet to 2 rooms away. As I moved away the download speeds reduced. I am currently on channel 3.

I suspect a hardware problem with the miniature wifi stick because even my PC is not able to get proper speeds on it (see my prev post above).

Modifying my boot cmdline did not seem to change much.

Code: Select all
~ > netstat -d -i | column -t                                                                                 Kernel  Interface  table
Iface   MTU        Met    RX-OK  RX-ERR  RX-DRP  RX-OVR  TX-OK  TX-ERR  TX-DRP  TX-OVR  Flg
lo      16436      0      0      0       0       0       0      0       0       0       LRU
wlan0   1500       0      2055   0       7100    0       1465   0       0       0       BMRU
~ > sudo iwlist wlan0 scan | grep Channel                                                                                         Frequency:2.422 GHz (Channel 3)
                    Frequency:2.412 GHz (Channel 1)
                    Frequency:2.442 GHz (Channel 7)
                    Frequency:2.437 GHz (Channel 6)
                    Frequency:2.462 GHz (Channel 11)
                    Frequency:2.462 GHz (Channel 11)
cyclicredundancy
 
Posts: 3
Joined: Fri Apr 26, 2013 1:31 am

Re: Miniature Wifi module seems slow

by tldr on Mon Apr 29, 2013 7:25 am

ok, i have a new problem. i read that whole thread and now my eyes are bleeding.

i made the change to cmdline.txt, though, before actually reading it, and it did not appear to help. not really surprising, though, since the fix appears to be for systems with low or full speed devices dropping usb packets and the high speed wifi dongle is the only usb device connected to my pi. apparently the problem they were chasing is related to the usb hub on the ethernet controller, so the easiest fix is to save one's self ten bucks and get a model a.

anyway, no joy.

Code: Select all
netstat -d -i
Kernel Interface table
Iface       MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0         0      0      0 0             0      0      0      0 BMU
lo        16436 0         0      0      0 0             0      0      0      0 LRU
wlan0      1500 0      2288      0   2409 0           646      0      1      0 BMRU
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am