WiFi problems, PREEMPT_RT, and connman (kernel 4.4.54)

Greetings,

Quick summary: I ran into some problems with WiFi after installing PREEMPT_RT packages. But I found a workaround.

I just bought a BBB Rev. C and installed the latest software image from beagleboard.org
bone-debian-8.7-iot-armhf-2017-03-19-4gb.img.xz

I also purchased an Edimax EW-7811Un N150 Nano USB WiFi adapter. With that stock image, I was able to get a working Wifi connection by following the connmanctl comments in the /etc/network/interfaces file. It would power up and connect automatically after shutting down the BBB and restarting it.

I also wanted to try out the PREEMPT_RT features, so I installed the following packages:

linux-image-4.4.54-bone-rt-r16
linux-firmware-image-4.4.54-bone-rt-r16
rtl8723bu-modules-4.4.54-bone-rt-r16
ti-sgx-es8-modules-4.4.54-bone-rt-r16
ti-sgx-es9-modules-4.4.54-bone-rt-r16

I wasn’t sure if I needed anything other than the linux image but I installed all that other stuff anyway. After installing and rebooting, entering the command “uname -a” shows:

Linux beaglebone 4.4.54-bone-rt-r16 #1 PREEMPT RT Fri Mar 17 08:46:38 UTC 2017 armv7l GNU/Linux

I also did a sudo apt-get upgrade.

Unfortunately, after doing all of those things, I didn’t have any luck getting the wifi working again. It may have worked once or twice after manually popping the wifi adapter in and out and reconfiguring things manually. But I couldn’t get it to power up and connect automatically again after shutting down the BBB and restarting it.

I finally got my wifi working again. Here are the steps in case anybody has a similar problem or can suggest a simpler solution after reading them:

  1. I wasn’t comfortable with connman so I got rid of it.

sudo apt-get remove --purge connman

  1. I tried to enable wlan0 in /etc/network/interfaces but it was getting renamed to some long string based on the wifi adapter’s MAC address! Nothing seemed to worked with that new name. After googling, it seems lots of folks have had that problem. Here is a workaround I found for that:

Create a file called: /etc/udev/rules.d/10-network.rules

If wifi MAC is aa:bb:cc:dd:ee:ff, then add a single line of text to that file:

SUBSYSTEM==“net”, ACTION==“add”, ATTR{address}==“aa:bb:cc:dd:ee:ff”, NAME=“wlan0”

  1. I used the steps in Molloy’s book to create a /etc/wpa.conf file for the wifi credentials.

sudo ifup wlan0

The blue light came on in the USB wifi adapter.

iwlist wlan0 scan

Info about the wlan0 link appeared.

su root
sudo wpa_passphrase > /etc/wpa.conf
exit

Then I did some hand-editing based on the iwlist info. My /etc/wpa.conf file looked like:

network={
ssid=“”
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk=
}

  1. I had problems with DHCP unless I manually assigned the gateway. So I assigned a static IP in the settings for wlan0 in the /etc/network/interfaces file. Note the additional line for apply the /etc/wpa.conf file.

auto wlan0
iface wlan0 inet static
address 192.168.2.202
netmask 255.255.255.0
gateway 192.168.2.1
wpa-conf /etc/wpa.conf

  1. I had problems unless eth0 was down. So I commented out auto eth0 in /etc/network/interfaces.

Voila! My wifi powers up and connects automatically after shutting down and restarting my BBB.

(BTW, I entered all commands and did all edits through a serial debug cable connection.)