This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf5 SDK IoT cannot ping nrf52840 from router

Hi!

I'm trying to do the TCP example with the nRF5_SDK_16.0.0_98a08e2, a nrf52840 DK board and a Raspberry Pi 3 B+ as a gateway but I got some problems.

For connecting the board to the Raspberry Pi I've followed the instructions from the tutorials (https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.iotsdk.v0.9.0/iot_getting_started.html?cp=7_4_2). My shell script derived from the tutorial looks like this:

#!/bin/sh
# Mount debugfs file system
mount -t debugfs none /sys/kernel/debug

# Load 6LoWPAN module
modprobe bluetooth_6lowpan

# Enable 6LoWPAN
echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable

# Set IPv6 forwarding
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding

# Run Router-Advertisement Daemon (radvd)
service radvd restart

# Look for available HCI devices
# hciconfig

# Reset HCI device
hciconfig hci0 reset

# Read BLE-Address from nRF51
timeout 3s hcitool lescan

# Connect to the device
echo "connect 00:81:1D:38:22:71 1" > /sys/kernel/debug/bluetooth/6lowpan_control
sleep 3

# Add the IP prefix to the Bluetooth Interface bt0
ip address add 2001:db8::2/64 dev bt0
ifconfig bt0

# Restart radvd service
service radvd restart

echo "ping the BLE device using the global address"
ping6 2001:db8:1::281:1dff:fe38:22:71 -c 5

Further, I have the following radvd.conf file:

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

Now if I run the script, it is not possible to ping the nrf52840 board. The output I get is as follows:

bt0: flags=4161<UP,RUNNING,MULTICAST>  mtu 1280
        inet6 fe80::b827:ebff:fef5:2a08  prefixlen 64  scopeid 0x20<link>
        inet6 2001:db8::2  prefixlen 64  scopeid 0x0<global>
        unspec B8-27-EB-F5-2A-08-78-B3-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 1  bytes 20 (20.0 B)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 12  bytes 1173 (1.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ping the BLE device using the global address
ping: 2001:db8:1::281:1dff:fe38:22:71: Name or service not known

Also, if I send an echo request to discover all devices that are currently attached to the RasPi router, I only get responses from the bt0 interface an no response from the BLE device:

sudo ping6 -I bt0 ff02::1
PING ff02::1(ff02::1) from fe80::b827:ebff:fef5:2a08%bt0 bt0: 56 data bytes
64 bytes from fe80::b827:ebff:fef5:2a08%bt0: icmp_seq=1 ttl=64 time=0.154 ms
64 bytes from fe80::b827:ebff:fef5:2a08%bt0: icmp_seq=2 ttl=64 time=0.147 ms
64 bytes from fe80::b827:ebff:fef5:2a08%bt0: icmp_seq=3 ttl=64 time=0.123 ms

Another observation that I made is that every time approximately after 30 seconds the nrf52840 BLE device loses its BLE connection.

My Raspberry Pi has kernel version 4.19.66-v7+ and runs Raspbian Stretch.

I tried changing BLE_6LOWPAN_LEGACY_MODE in the sdk_config.h from 1 to 0 (according to this post with a similar problem: https://devzone.nordicsemi.com/f/nordic-q-a/44801/nrf-sdk-iot-mqtt-publisher-example-can-t-ping-from-bt0-and-interface-go-down) but it didn't change anything.

Even if I simply run the given instructions (see below) from the tutorial I cannot ping the board.

#!/bin/sh

# 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
sleep 2

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

# Connect to the device.
echo "connect 00:81:1D:38:22:71 1" > /sys/kernel/debug/bluetooth/6lowpan_control
sleep 3

# Check if you have established a connection.
ifconfig

# Try to ping the device using its link-local address, for example, on bt0 interface.
ping6 -I bt0 fe80::281:1dff:fe38:2271

When sending the ping to the link local address I do not get any response:

ping6: Warning: source address might be selected on device other than: bt0
PING fe80::281:1dff:fe38:2271(fe80::281:1dff:fe38:2271) from :: bt0: 56 data bytes
^C
--- fe80::281:1dff:fe38:2271 ping statistics ---
27 packets transmitted, 0 received, 100% packet loss, time 26620ms

I searched the Nordic forums a lot, but in almost every post that I found, people were at least able to ping the BLE board.

If maybe somebody experienced the same problem and could help me I would be very glad.

Parents
  • EDIT: I made a small mistake with the ping of the global ipv6 address of the board

    The address has to be 2001:db8::281:1dff:fe38:22:71

    But with this address I get no ping response:

    ping the BLE device using the global address
    PING 2001:db8::281:1dff:fe38:22:71(2001:db8:0:281:1dff:fe38:22:71) 56 data bytes
    
    --- 2001:db8::281:1dff:fe38:22:71 ping statistics ---
    5 packets transmitted, 0 received, 100% packet loss, time 4198ms

Reply
  • EDIT: I made a small mistake with the ping of the global ipv6 address of the board

    The address has to be 2001:db8::281:1dff:fe38:22:71

    But with this address I get no ping response:

    ping the BLE device using the global address
    PING 2001:db8::281:1dff:fe38:22:71(2001:db8:0:281:1dff:fe38:22:71) 56 data bytes
    
    --- 2001:db8::281:1dff:fe38:22:71 ping statistics ---
    5 packets transmitted, 0 received, 100% packet loss, time 4198ms

Children
No Data
Related