Skip to content

lab11/gap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GAP: Generic Access Point

GAP is the WiFi router for low-power and embedded Internet of Things devices. While WiFi routers provide ubiquitous Internet access for laptops and smartphones, GAP provides Internet access for low-power sensors and wearable devices. It supports both 802.15.4 and Bluetooth Low Energy.

GAP is implemented as a cape for the BeagleBone Black. It uses two TI CC2520 radios and a Nordic nRF51822 radio to provide connectivity. Each radio has a linux kernel module to allow userspace access to the radios.

Hardware

The GAP cape features a SPI interface to two CC2520 radios, one of which is amplified with a CC2591, and one nRF51822 radio. It also includes four LEDs.

Software

The CC2520 radios are supported natively in newer versions of the Linux kernel (>=4.1).

The nRF51822 BLE radio is a work-in-progress. It can be used as a standalone BLE radio (see this repo for a starting point), but does not have great integration with the BBB at this point.

Setting Up GAP

To setup a BBB to work with GAP, follow these instructions:

  1. Start with a recent build of Debian for the BBB. We suggest starting with pretty new version of Debian, like that can be found here.

  2. Once that is setup, ssh to the BBB and update the kernel to the newest version. This will not only make sure you're running the latest code, but also ensure all of the kernel modules will be present.

     sudo apt-get update
     sudo apt-get install vim git lsb-release
     sudo /opt/scripts/tools/update_kernel.sh --beta --bone-channel
    

    Luckily Robert C Nelson has made this really easy with a convenient script.

  3. Now we have to setup the device tree overlay to let Linux know that the the radios exist. The GAP overlay and others are setup in a repository also maintained by RCN.

     git clone https://github.com/lab11/bb.org-overlays
     cd bb.org-overlays
     ./dtc-overlay.sh
     ./install.sh
    

    That puts the compiled overlay in the correct place, now we need to tell the BBB to use it at boot.

     vim /boot/uEnv.txt
     # Edit that line that looks like this to include the reference to GAP
     cape_enable=bone_capemgr.enable_partno=BB-GAP
    
  4. Reboot to apply this.

     sudo reboot
    

Sniffing 15.4 Packets

To make sure everything is working, it is pretty easy to get Linux to print out the packets the radio is receiving.

  1. Install the wpan-tools to configure all of the 15.4 devices.

     sudo apt-get install pkg-config libnl-3-dev libnl-genl-3-dev
     wget http://wpan.cakelab.org/releases/wpan-tools-0.5.tar.gz
     tar xf wpan-tools-0.5.tar.gz
     cd wpan-tools-0.5
     ./configure
     make
     sudo make install
    
  2. Install tcpdump to view the packets.

     sudo apt-get install tcpdump
    
  3. Configure the network devices. Be sure to set the channel and PANID to match what is transmitting the 15.4 packets.

     iwpan phy phy0 set channel 0 11
     iwpan dev wpan0 del
     iwpan phy phy0 interface add wpan0 type node c0:98:e5:00:00:00:00:01
     iwpan dev wpan0 set pan_id 0x0022
     /sbin/ifconfig wpan0 up
    
  4. Use tcpdump to view them.

     sudo tcpdump -i wpan0 -vvv
    

    OR, use a simple c program to read from the raw socket.

     cd linux
     gcc recv_raw_802154.c -o raw
     sudo ./raw
    

    OR, use a very similar python script:

     cd linux
     sudo python recv_raw_802154.py
    

RPL Border Router

GAP can be setup as a border router running a 6LoWPAN based mesh network with RPL as a routing layer. It uses unstrung to provide the RPL implementation. The rest is supported by the Linux kernel.

To set this up:

  1. Setup the radios and network interfaces:

     sudo iwpan phy phy1 set channel 0 23
     sleep 15
     sudo iwpan dev wpan1 del
     sleep 15
     sudo iwpan phy phy1 interface add wpan1 type node c0:98:e5:00:00:00:00:01
     sleep 15
     sudo iwpan dev wpan1 set pan_id 0x0022
     sleep 15
     sudo ip link add link wpan1 name lowpan1 type lowpan
     sleep 15
     sudo ifconfig lowpan1 up
     sleep 15
     sudo ifconfig wpan1 up
    

    Note: I've found that putting a sleep between those commands makes everything run smoothly. Calling them too quickly seems to break things (at least in the past, it's possible that newer commits have solved this issue).

  2. Get unstrung.

     git clone https://github.com/mcr/unstrung.git
     cd unstrung
     make
    

    There may be commits that need to be applied to make this work. Look at unstrung pull requests to see if there are outstanding patches that are required.

  3. Run unstrung.

     /home/debian/unstrung/programs/sunshine/sunshine --verbose --dagid 0x11112222333344445555666677778888 -i lowpan1 -W 10000 --stderr -R 1 --prefix 2607:f018:800:201:c298:e588:4400:1/64 -m
    
  4. You should be able to ping a node:

     sudo ping6 2607:f018:800:201:c298:e522:2200:bb -s 16
    

About

802.15.4 and BLE cape for the BeagleBone Black

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published