1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/nordic_softdevice_ble/README-BLE-6LoWPAN.md
Martine Lenders 8f5f6dcacd nordic_softdevice_ble: document working Linux versions
It is not 100% clear if 4.12 is the last version the softdevice is able
to interact with, but newer kernel versions than 4.12 definitely
don't work (we tried 4.15 on Ubuntu 18.04 and 4.20 on a quite recent
Arch).

The reason I believe it's the 4.12 that last worked is that in the
documentation of the nRF5 SDK it is mentioned for something called
"legacy mode" [1]. However, we are using the nRF5 *IoT* SDK which
doesn't mention this legacy mode at all.

I don't know if we can update the `pkg` to the other SDK, so I just
updated the documentation accordingly for now.

[1]: https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/group__ble__6lowpan__config?9932#ga5285fd3eaf403092286f607cd66850f3
2019-01-18 14:46:13 +01:00

3.0 KiB

This README contains information how to establish an IPv6 connecton between Linux BLE router and an IPSP enabled BLE device.

Prerequisites

In general, any device capable of running Linux operating system, can be used as a BLE router provided the following conditions are met:

  • Linux Kernel >3.18 and <=4.12 is used
  • bluez, libcap-ng0, radvd tools are present.

If a built-in Bluetooth device is not available then Bluetooth 4.0 compatible USB dongle can be used.

The following procedures have been tested on Ubuntu 15.10 and Ubuntu 16.04.

Establishing an IPv6 connection

Use the following procedure to establish a connection between an nRF52 device and Linux router:

First enable 6LoWPAN module. This is neccessary only once per session:

# Log in as a root user.
sudo su

# Mount debugfs file system.
mount -t debugfs none /sys/kernel/debug

# Load 6LoWPAN module.
modprobe bluetooth_6lowpan

# Enable the bluetooth 6lowpan module.
echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable

# Look for available HCI devices.
hciconfig

# Reset HCI device - for example hci0 device.
hciconfig hci0 reset

# Read 00:AA:BB:XX:YY:ZZ address of the nRF5x device.
hcitool lescan

If you see device name and address in lescan output then you can connect to the device:

echo "connect 00:AA:BB:XX:YY:ZZ 1" > /sys/kernel/debug/bluetooth/6lowpan_control

If above is successful then LED1 will stop blinking and LED2 will switch on. You can then check the connection using the following commands:

# Check if bt0 interface is present and up
ifconfig

# Try to ping the device using its link-local address, for example, on bt0 interface.
ping6 fe80::2aa:bbff:fexx:yyzz%bt0

If you'd like to learn more about the procedure please refer to Connecting devices to the router.

Distributing routable IPv6 prefix

In Linux, Router Advertisement Daemon (RADVD) can be used to distribute prefixes in the network, hance configure routable IPv6 address.

To configure RADVD create /etc/radvd.conf file and paste the following contents:

interface bt0
{
    AdvSendAdvert on;
    prefix 2001:db8::/64
    {
        AdvOnLink off;
        AdvAutonomous on;
        AdvRouterAddr on;
    };
};

Next, start RADVD daemon:

# Set IPv6 forwarding (must be present).
sudo echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
# Run radvd daemon.
sudo service radvd restart

If successfull then all devices connected to the host will receive a routable 2001:db8 prefix.

This can be verified by sending echo request to the full address:

ping6 -I bt0 2001:db8::2aa:bbff:fexx:yyzz

where aa:bbff:fexx:yyzz is device Bluetooth address.

If you'd like to learn more about the procedure please refer to Distributing a global IPv6 prefix.