Home‎ > ‎Sergey's Blog‎ > ‎

Intel Galileo Meets Wireless

posted Oct 25, 2013, 9:19 PM by Sergey Kiselev   [ updated Oct 30, 2013, 8:08 AM ]
One of significant advantages of Galileo over similar SBCs is availability of mini PCI Express connector. It can be used to add a high speed WiFi adapter without taking the USB port.



Mini PCI-E Wireless Adapter

I recommend using an Intel Wireless adapter. These adapters are well supported by Linux. There are several wireless adapter models available. Some of them include Bluetooth support, some 5 MHz band, some even have WiMax. Note that officially current Galileo SD image only supports Intel® Centrino® Wireless-N 135 and Intel® Centrino® Advanced-N 6205 adapters. Although support for many other adapters can be easily added. I used Intel® Centrino® Advanced-N 6235. While it is a bit more expensive than N135 or N6205, it supports 802.11a/b/g/n standards, including 5 GHz band, and also has a built in Bluetooth.


You'll need a pair of WiFi antenna with Hirose U.FL connectors. There are two options here:

  1. A pair of antenna with RP-SMA connectors (these are common on home wireless routers), and a pair of U.FL to RP-SMA cables.
  2. Laptop style antenna with U.FL connectors.
With the first option you'll get better wireless reception. The second option is preferable for compact systems, as these antenna can be mounted inside the enclosure you'll be using to host your Galileo project. I decided to go with the first option and purchased a kit with a pair of antenna and cables from Amazon.

Full Size to Half Size Mini PCI-E Bracket

Modern PCI-E WiFi adapters have a half size form factor, while Galileo has a retention latch spaced for a full size adapters. If you'll try to install a half size card in it, it will not stay in place (unless you use glue or a sticky tape :-)). Fortunately full size to half size brackets are cheaply available from multiple sources like Amazon and eBay.

Mounting Antenna

Hirose U.FL. connectors are fragile and not supposed to be reconnected multiple times. Thin coaxial cables are not very sturdy either. So I recommend attaching antenna to Galileo to reduce movement of these cables and connectors. Of course if you are using an enclosure for your project, you can mount antenna on that enclosure. Since I am still experimenting with my Galileo, and like to have it open I made a bracket myself from a spare piece of aluminum. An aluminum angle would work as well. I drilled four holes: Two 9/64" holes spaced at 2.5" on one side for attaching the bracket to the Galileo. And two holes 1/4" for RP-SMA connectors on the other side.

Putting It All Together

The process is pretty straightforward:
  • Attach the adapter bracket to mini PCI-E wireless adapter with two screws supplied with the bracket.
  • Install wireless into Galileo. Insert it at approximately 30 degrees. Push it sideways and then down. Make sure retention latches are locked inside the holes of the bracket.
  • Install pigtail cables in the angle bracket.
  • Install angle bracket on the Galileo board.
  • Attach pigtail cables to U.FL connectors on the mini PCI-E.
  • Attach antenna.
Picture below shows my Galileo board with wireless card and bracket installed and cables attached to the wireless card.

Complete assembly

Configuring Wireless In Linux

Intel Supplied SD Card Image

Intel supplied SD card image only includes iwlwifi-135-6.ucode and iwlwifi-6000g2a-6.ucode firmware. In my case for the N6235 card I needed to get iwlwifi-6000g2b-6.ucode from http://wireless.kernel.org/en/users/Drivers/iwlwifi (it is in iwlwifi-6000g2b-ucode- file). To install firmware on my Galileo I copied the iwlwifi-6000g2b-ucode- archive to SD card, booted the Galileo, unzipped and copied firmware to the /lib/firmware directory:

root@clanton:/tmp# tar xzvf /media/mmcblk0p1/iwlwifi-6000g2b-ucode-
root@clanton:/tmp# cp iwlwifi-6000g2b-ucode- /lib/firmware/

Once proper firmware is installed use the following steps to configure wireless (this assumes using WPA security).

  1. Login to your Galileo as root
  2. Run the following command to generate wpa_supplicant configuration file for your network. Replace MyWiFi with the SSID of your wireless networkand MyPassPhrase with the real passphrase:
    root@clanton:~# wpa_passphrase MyWiFi << EOF > /etc/wpa_supplicant.conf
    > MyPassPhrase
    > EOF
  3. If you wish to configure your Galileo to connect to the wireless network automatically, edit /etc/network/interfaces file and add auto wlan0 line somewhere in the file. I suggest putting it right before iface wlan0 line:

    # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

    # The loopback interface
    auto lo
    iface lo inet loopback

    # Wireless interfaces
    auto wlan0
    iface wlan0 inet dhcp
            wireless_mode managed
            wireless_essid any
            wpa-driver wext
            wpa-conf /etc/wpa_supplicant.conf
  4. Restart networking:
    root@clanton:/etc# /etc/init.d/networking restart
    Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
    Reconfiguring network interfaces...
    ifdown: interface wlan0 not configured
    ifdown: interface eth0 not configured
    udhcpc (v1.20.2) started
    Sending discover...
    Sending select for
    Lease of obtained, lease time 86400
    /etc/udhcpc.d/50default: Adding DNS
    udhcpc (v1.20.2) started
    Sending discover...
    Sending discover...
    Sending discover...
    No lease, failing
  5. You can also bring wireless interface up or down using ifup wlan0 and ifdown wlan0 command (even if you didn't enable auto connect in step 3):
    root@clanton:/etc# ifdown wlan0
    [ 1180.113711] wlan0: deauthenticating from c8:60:00:d2:95:2c by local choice (reason=3)
    [ 1180.183410] cfg80211: Calling CRDA to update world regulatory domain
    root@clanton:/etc# ifup wlan0
    Successfully initialized wpa_supplicant
    [ 1186.273174] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
    [ 1186.287015] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
    [ 1186.563247] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    udhcpc (v1.20.2) started
    Sending discover...
    [ 1189.866932] wlan0: authenticate with c8:60:00:d2:95:2c
    [ 1189.888080] wlan0: send auth to c8:60:00:d2:95:2c (try 1/3)
    Sending discover...
    [ 1190.100271] wlan0: send auth to c8:60:00:d2:95:2c (try 2/3)
    [ 1190.106813] wlan0: authenticated
    [ 1190.120257] wlan0: associate with c8:60:00:d2:95:2c (try 1/3)
    [ 1190.127349] wlan0: RX AssocResp from c8:60:00:d2:95:2c (capab=0x11 status=0 aid=2)
    [ 1190.159137] wlan0: associated
    [ 1190.162421] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
    Sending discover...
    Sending select for
    Lease of obtained, lease time 86400
    /etc/udhcpc.d/50default: Adding DNS

LSB-compliant Image

If compiled correctly LSB image will contain iwlwifi kernel module and firmware for current Intel wireless adapters.

Poky LSB compliant image uses connman for managing network connections. I used the following procedure to configure wireless there.

  1. Login to your Galileo as root
  2. Start connmanctl:
    root@clanton:~# connmanctl
  3. Enable wireless using enable wifi command:
    connmanctl> enable wifi
  4. Scan for available wireless networks using scan wifi command:
    connmanctl> scan wifi
    Scan completed
  5. Display available wireless network and note one you want to connect to:
    connmanctl> services
        MyWiFi               { wifi_b4b6765faaf0_4d7957694669_managed_psk }
        Guest                { wifi_b4b6765faaf0_4775657374_managed_psk }
        kafenet              { wifi_b4b6765faaf0_6b6166656e6574_managed_psk }
        DIPPELFAMILY         { wifi_b4b6765faaf0_44495050454c46414d494c59_managed_psk }
        aussie               { wifi_b4b6765faaf0_617573736965_managed_psk }
        aussie               { wifi_b4b6765faaf0_hidden_managed_psk }
        EverydayParadise     { wifi_b4b6765faaf0_45766572796461795061726164697365_managed_psk }
        5VHXG                { wifi_b4b6765faaf0_3556485847_managed_psk }
        Moria-2G_xt          { wifi_b4b6765faaf0_4d6f7269612d32475f7874_managed_psk }
        unknown_protocol     { wifi_b4b6765faaf0_756e6b6e6f776e5f70726f746f636f6c_managed_psk }
        Stock-House          { wifi_b4b6765faaf0_53746f636b2d486f757365_managed_psk }
        Moria-2G             { wifi_b4b6765faaf0_4d6f7269612d3247_managed_psk }
        5NFP6                { wifi_b4b6765faaf0_354e465036_managed_wep }
        Moria-Guest          { wifi_b4b6765faaf0_4d6f7269612d4775657374_managed_psk }
        XEMT2                { wifi_b4b6765faaf0_58454d5432_managed_wep }
        4RDS1                { wifi_b4b6765faaf0_3452445331_managed_wep }
        Kingdom1             { wifi_b4b6765faaf0_4b696e67646f6d31_managed_wep }
        Belkin_N+_D57D20     { wifi_b4b6765faaf0_42656c6b696e5f4e2b5f443537443230_managed_none }
        Comcast              { wifi_b4b6765faaf0_436f6d63617374_managed_wep }
    (As you can see I have way too many wireless access points in my neighborhood... some are even wide open)
  6. Next three steps are needed because currently connmanctl lacks command to setup passphrase for a network.
    Exit connman for now using exit command:
    connmanctl> exit
  7. Create a file in /var/lib/connman/. The file name is not really important. The header (first line of the file) should be in [service_<service_name>] format, where <service_name> is the name from the services command output above matching SSID of your network. Set the Security value according to the security type of your network (wep, wpa, none). Also set the Passphrase value to the passphrase of your wireless network:
    root@clanton:~# cat << EOF > /var/lib/connman/wifi.config
    Type = wifi
    Security = wpa
    Name = MyWiFi
    Passphrase = MyPassPhrase

  8. Stop and start connman to re-read configuration:
    root@clanton:~# /etc/init.d/connman stop
    Stopping Connection Manager
    root@clanton:~# /etc/init.d/connman start
    Starting Connection Manager
    Shortly you should see something like this on your console:
    [ 1879.331020] eth0: device MAC address 00:13:20:ff:16:af
    [ 1879.357126] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [ 1879.403465] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
    [ 1879.417585] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
    [ 1879.701814] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [ 1892.405363] wlan0: authenticate with c8:60:00:d2:95:2c
    [ 1892.431336] wlan0: send auth to c8:60:00:d2:95:2c (try 1/3)
    [ 1892.640274] wlan0: send auth to c8:60:00:d2:95:2c (try 2/3)
    [ 1892.647289] wlan0: authenticated
    [ 1892.660276] wlan0: associate with c8:60:00:d2:95:2c (try 1/3)
    [ 1892.674197] wlan0: RX AssocResp from c8:60:00:d2:95:2c (capab=0x11 status=0 aid=2)
    [ 1892.706347] wlan0: associated
    [ 1892.709495] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
  9. You can run ifconfig command to make sure that wlan0 interface is configured correctly:
    root@clanton:~# ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:13:20:ff:16:af
              UP BROADCAST MULTICAST DYNAMIC  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:322 (322.0 B)

    lo        Link encap:Local Loopback
              inet addr:  Mask:
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:32 errors:0 dropped:0 overruns:0 frame:0
              TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:2240 (2.1 KiB)  TX bytes:2240 (2.1 KiB)

    wlan0     Link encap:Ethernet  HWaddr b4:b6:76:5f:aa:f0
              inet addr:  Bcast:  Mask:
              inet6 addr: fe80::b6b6:76ff:fe5f:aaf0/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:936 errors:0 dropped:453 overruns:0 frame:0
              TX packets:153 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:142868 (139.5 KiB)  TX bytes:36885 (36.0 KiB)