Thursday, 2 March 2017

Raspberry Pi 3: integral wifi problems

A couple of days ago I was given a nice new Pi 3.

I already have one other Pi 3 (and 14 other non-Pi 3 models) but it developed a fault, so this new one was a welcome birthday present.

Unfortunately it took most of yesterday afternoon to get the integral wifi for work!

The problem with my earlier Pi 3 is that there is no longer a 5V supply on the USB connectors. From what I can tell, the USB supply comes from a chip that can be used to control max current.

I can still use this dodgy Pi 3 if I connect a powered USB port. But that's too much of a faff (...and a waste of a 13A mains socket).

my wifi problem

With the new Pi 3, I transferred the sd card from an existing Pi 2, did the usual update/upgrade stuff and then removed the USB wifi dongle I was using.

As the internal wifi did not operate, I assumed I had to enable something, so then embarked on a fruitless web search. A few poor folk on the forum seemed to be having similar problems (in that the wifi drivers were clearly not loading) but were mostly ignored, dismissed as idiots, or their threads were hijacked by people who clearly had simple configuration issues.

As there didn't seem to be any magic switches to turn it on, it looked like I'd probably broken something that update/upgrade wasn't going to fix.

Using iwconfig confirmed that I didn't have an interface for the integral wifi. I did discover that the driver is in the repository, so I opened Synaptic, found it was already installed, but reinstalled it again anyway.

Using the Linux command lsmod I confirmed that the driver was not loading. It should appear in the output as: drmcfmac

Now at this stage, I could have cut-my-losses and just reinstalled Raspbian. But the image on the sd card had been set up some time ago and has been used as a sort of desktop computer. So it would have taken me hours to save the files I wanted to keep, re-image the sd, delete the bloat-ware that I did not need, and re-configure the system to suit my needs.

tea break

After yet another cup of builders tea, I started poking around in the /etc/modprobe.d folder (I can't remember why). But I got lucky when I opened: /etc/modprobe.d/8812au.conf which contained:-

Aha! So the driver has been blacklisted. I can only guess this happened when I installed the driver for the Edimax dual band dongle several months ago, because I think this requires the 8812 driver.

Anyway, commenting out the blacklist line with a # seemed to do the trick, and the integral wifi adaptor was working again. Running lsmod now produces this output:-

However, in its current physical location (on the desk in my man-cave) it does not perform that well. The data rate (which is probably the most important parameter) is quite variable, e.g. it might be 65Mbps one moment, then 24Mbps or lower the next. So I may go back to using a plug-in USB wifi dongle, as I have a Edimax EW-7612Uan which gives a steady 130Mbps, and I don't have another use for it at the moment.

This was a useful exercise as I was thinking of buying a couple of those new Pi Zero boards with on-board wifi for the 'maple tree' bird box. However, as this box is located a long way from the house, I doubt that I would get a good wifi data rate. So I'm going to order the plain Pi Zero variety and do my horrible USB hack as I did for the other bird box system.

using grep

As an after-thought, I should have used grep to search files for the string "brcmfmac" or maybe the word "blacklist". The /etc folder is normally the one to look in for issues relating to modules like this. So maybe try:-

sudo grep -rnwl '/etc/' -e 'brcmfmac'

This search method is not so good on all system files. For example, if you try to search through all files from the root folder like this:-

sudo grep -rnwl '/' -e 'brcmfmac'

You will get lots of junk output, and it will take a long time. So just start any searches using targeted system folders (e.g. /etc, /usr, possibly /lib, & so on).

Wifi checklist

I've previously posted about this, so refer to my earlier post for details here:

...but what follows is a simple diag checklist. Any commands should be run in a terminal:-

1. If the wifi interface is a USB device, make sure it is listed when you run: lsusb

Note that the Pi3 integral wifi interface is not USB, so start at point 2.

2. If (1) was OK, check that the driver module is loaded for your device by running: lsmod

Ideally you need to know the driver name for your device. But for USB devices, you could just run lsmod before and after you have inserted the USB device, and identify the driver that way.

3. Assuming (3) is OK, check to see if you have a wifi interface by using: iwconfig
this might have a common name like wlan0 or wlan1, or could be a little more exotic like wlp2so.

4. If (3) is OK, check the iwconfig output to see if it is associated with an access point. If not, try: sudo iwlist scan

If the device is working, you should see a number of local access points (i.e. your wifi router and probably your close neighbours).

5. If (4) is OK then congratulations! you have a working wifi device. You just need to configure your system to complete the link with your access point.

6. You need to connect to a named access point (i.e. the SSID of your router) with a passphrase, so check/edit the /etc/wpa_supplicant/wpa_supplicant.conf file.

7. You need a sensible /etc/network/interfaces file, so include just the bare minimum, or use the default file to start with.

8. If (1) to (7) are OK, but you still can't get wifi access, try temporarily turning off wifi security on your router. If this works, take a closer look at wpa_supplicant (...and don't forget to turn security back on).

What could possibly go wrong?

USB device problems?

If you don't see the USB device listed via lsusb, you probably need to search the internet for help.
If you can plug it into another Linux computer and run lsusb successfully, note the manufactures device code (e.g. 7392:a812) as this is the only reliable way of identifying the manufacturer (first 4 digits) and the device identity (second 4 digits). This may help with tracking down information from the internet. If you cant get it to work on any computer, its probably a goner!

module/driver problems?

If you don't see a driver for your device when you use lsmod, then you either don't have the correct driver installed, or it is installed but is not being loaded. You can't progress until this is sorted.

Power supply problems?

Its possible, e.g. (1) on an early model B Pi (the ones with the polyfuses) I had a problem with an Edimax that would not run reliably from the top USB socket, but seemed OK on the lower socket. I suspect the USB supply voltage was just dropping too low for reliable operation. (2) Recently I tried running an Edimax from a powered hub. It did not work, but worked fine when plugged straight into the Pi. I don't know why, life's a bitch.

It was working, but suddenly stopped, wtf?

Before you go back through the checklist, check the channel that your router is using. Different countries use a different mix of the common 2.4GHz channels 1-14.

Wifi routers are generally configured to auto switch channels if the going gets tough (e.g. if the router starts out using channel 6, then a neighbouring router starts up on the same channel, your router may switch to channel 11, or some other channel that looks relatively clear of traffic).

Let's say your router is set to the GB plan, but your Pi is set to US. If your router scuttles up to channel 13 to get away from the local noise, your Pi won't be able to follow, and you will lose wifi.

So temporarily set router manually to channel 1 while diaging this problem.

If you have a smart phone, get a wifi scanner app. This should give you a graphical display of local wifi signals by strength and channel, and you can walk around your estate checking for coverage and conflicts.


  1. I've two Pi 3s, and the wireless has stopped working on both of them. Not listed via lsub. worked for a day or so, then gave up. bit disappointing, I havent looked into it much, as they both now have edimax wifi dongles which seems to defeat the point really.... your solution didnt work on mine.

  2. Hi, prompted by your problem, I've now added some diagnostic notes to the post above. It would be worth checking the wifi channel in use first, and I'd be very interested in hearing from you when you find out what the issue is.

    I don't think the onboard Pi3 wifi can compete with a good USB dongle, but its OK if your Pi3 does not wander too far from your router. I've even seen a post somewhere showing how to add an aerial to the Pi3 pcb. But even the author says "...don't try this at home".