23 January 2014

31.4 Days with a Raspberry Pi Noob - Day 12, Bluetooth with Cambridge Silicon Radio (HCI Mode) Chip

My troubled history of trying to get a Bluetooth 2.0 adapter to work in Raspbian was as long as my struggle to get the Belkin Wi-Fi adapter to work. Raspbian identified my Bluetooth adapter as a Cambridge Silicon Radio Ltd. Bluetooth dongle (HCI mode) with USB ID 0a12:0001. The eLinux.org verified peripheral list says that my dongle works. However, I had the same problem using this dongle as the following Raspberry Pi forum post described:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=65265
After scouring the Internet for solutions, some of which suggested hardware issues, I concluded that this was probably a Raspbian problem like this kernel.org bug report indicated:
https://bugzilla.kernel.org/show_bug.cgi?id=60824
Yet I have not worked with my Pi long enough to have seen my Bluetooth dongle work in older kernels, and I don't know enough about compiling a kernel to apply that patch on my own. All I could assert was that my Bluetooth dongle works in Windows 7 when controlled by the BlueSoleil software.

Last night I discovered that Raspberry Pi forum user itsmedoofer built a new Raspbian kernel with the CSR Bluetooth patch and posted it online:
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=491056
Because itsmedoofer did all the hard work of compiling the kernel, all I had left to do was
  1. Download the kernel package
  2. Extract it on my Pi (I used the file manager in the graphic desktop to do that)
  3. Run software updates in an LXTerminal
  4. sudo rpi-update
    sudo apt-get update
    sudo apt-get upgrade
  5. Follow itsmedoofer's instruction to copy over all the package files
  6. sudo cp ~/New_Kernel_Try2/kernel.img /boot/kernel_new.img

    sudo cp ~/New_Kernel_Try2/lib/modules/3.10.27MEC_BTFIX+ /lib/modules

    sudo cp ~/New_Kernel_Try2/lib/firmware/* /lib/firmware
  7. Edit the /boot/config.txt file (sudo nano /boot/config.txt) by adding the following lines to the beginning of config.txt:
  8. kernel=kernel_new.img
    #kernel=kernel.img
  9. Reboot.
After that, my CSR Bluetooth dongle came to life for the first time on my Pi.

22 January 2014

31.4 Days with a Raspberry Pi Noob - Day 11, Wi-Fi with Realtek RTL8188SU Chip

Seeing my Wi-Fi dongle (Belkin F7D1101 v1) work more or less out-of-the-box on a Raspberry Pi (albeit on the Pidora operating system) gave me some encouragement and clues to make the dongle work in Raspbian.

For starters, I did a clean install of Raspbian on my SD card using NOOBS v1.3.4. Then I hot-plugged the Belkin dongle into the externally powered USB hub, opened the WiFi Config (wpa_gui) application from the desktop, and manually added my Wi-Fi settings, complete with WPA2 authentication. VoilĂ ! Suddenly my Pi was on the wireless network. Evidently, just like Pidora, Raspbian "wheezy" comes pre-installed with a driver for the Belkin dongle / Realtek RTL8188SU chip. However, while in Pidora I didn't notice any significant EM interference when the Wi-Fi dongle was active, in Raspbian I had significant trouble using my keyboard and trackball after the Wi-Fi dongle was activated. In the end I had to disconnect the USB hub and plug the Belkin dongle (with its plastic shell removed to produce a slimmer physical profile) directly into Pi's USB port.

From that point I re-assign a static IP address to the wired Ethernet port and installed a VNC server. As soon as I rebooted my Pi, there was a new problem: After each boot-up, the WiFi Config window would cease to show my wlan0 adapter setting. The command sudo /etc/init.d/networking reload to reinitialize all network interfaces didn't solve the problem, but the command sudo ifup -v wlan0 to manually bring up the Wi-Fi interface did. This led me back to the configuration file /etc/network/interfaces:
The line allow-hotplug wlan0 didn't sit right with me. The Wi-Fi dongle was left in the USB port whenever I power-cycled my Pi. There was no "hot-plug" event. Could that be why I had to manually bring up the Wi-Fi interface after each bootup? I changed that line to auto wlan0 and did another reboot test. This time (and every time afterwards) the Wi-Fi connection was able to establish automatically.

I made a backup image of the Wi-Fi-enabled NOOBS v1.3.4 SD card. Then I reverted back to a NOOBS v1.3.3 image prior to my installation of the r8712.ko Realtek firmware, made the same modification in /etc/network/interfaces, and got Wi-Fi working there as well. Was the rearrangement of the USB connection that did the trick, or was the modification of the network interface configuration that fixed the issue? I cannot tell.

In summary,
  1. The r8712u staging driver for Belkin F7D1101 v1 wireless adapter / Realtek RTL8818SU wireless chip is included on Raspbian "wheezy". There is no need to add any non-free repository or download any firmware.
  2. Belkin F7D1101 v1 adapter doesn't really need a powered hub. Pi's USB port is sufficient to power the adapter.
  3. If you are going to hot-plug your wireless dongle, get an externally powered USB hub. (Note: Get a decent-quality hub that shields out EM interference. My mouse and keyboard both saw interference issues when my USB hub was plugged in. Maybe the interference compounded my networking difficulty, too.)
  4. WiFi Config (wpa_gui) assumes you'll hot-plug your wireless dongle. If you are going to leave the dongle permanently plugged in, you may want to change /etc/network/interfaces to start the Wi-Fi interface on boot-up by replacing allow-hotplug wlan0 with auto wlan0 (or adding auto wlan0 a line above allow-hotplug wlan0).