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

Can't connect MQTT-subscriber to MQTT-broker running on RaspberryPi3

I can connect the board to the Pi and ping it with a globally valid IPv6.

When trying to connect with the MQTT broker, however, no package is sent from the Chip to the Pi.
After many tests in debugging mode I found out, which probably prevents sending the package:

(mqtt_transport_lwip.c: line 297)
err_t err = tcp_connect((struct tcp_pcb *)p_client->tcp_id, (ip_addr_t *)&p_client->broker_addr, p_client->broker_port, tcp_connection_callback);

The function returns "FFFFFFFC"

If my researches are correct, then this means that the nRF52 first requires a RouterAdvertisementMessage from a globally valid IPv6 address, which it does not receive according to my Wireshark analysis.
If so, how can I get the BT0 interface on the Pi, to do that? It only transmits with the link local IPv6 though it also has a global one.
Or am I completely on the wrong track?

Here my radvd.conf:

interface eth0
{
AdvSendAdvert on;
prefix fd00:b::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
route ::/0
{
};
};

interface bt0
{
AdvSendAdvert on;
prefix fd00:a::/64
{
AdvOnLink off;
AdvAutonomous on;
AdvRouterAddr on;
};
};

I'm running the "iot_mqtt_lwip_subscriber"-example from the SDK15 on nRF52840

I followed the instructions on this two pages, to configure the Raspberry:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Fiot_sdk_user_guides_radvd.html

http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Fiot_sdk_user_guides_radvd.html&cp=6_1_0_2_3_2&anchor=iot_sdk_radvd_alternatives.

Parents
  • Hi,

     

    How does your ifconfig and route -6 -n output look? You mention that you are able to ping the BT device, is this on the link-local or the global ip?

    In some cases, you might need to restart the radvd service in order to get the routes and global addresses to the bt0 interface.

    You can also add the route manually to make your device accessible in a larger network, as discussed here: https://devzone.nordicsemi.com/f/nordic-q-a/5481/making-ipv6-device-available-on-the-internet/19138#19138

     

    Cheers,

    Håkon

  • I have followed the instructions from your link exactly and still come to the same error. :(

    I really hope somebody can help me, because I'm hanging on to the problem for a week and I'm running out of ideas.

    Here are all informations about my setup

    I'm using the nRF52840-Preview-DK running the example:
    SDK\nRF5_SDK_15.0.0_a53641a\examples\iot\mqtt\lwip\subscriber
    I only adapted the IPv6-Broker address and changed the output of the error code.

    I tried with two versions of Raspbian:

    stretch (Linux version 4.14.34-7v+)
    jessie (Linux version 4.9.35-v7+)

    Both on a Pi 3 Model B with the intern BLE

     

    I'm able to ping the BT device:

    root@raspberrypi:/home/pi# ping6 2002::65:24ff:fe54:dc25
    PING 2002::65:24ff:fe54:dc25(2002::65:24ff:fe54:dc25) 56 data bytes
    64 bytes from 2002::65:24ff:fe54:dc25: icmp_seq=1 ttl=255 time=256 ms
    64 bytes from 2002::65:24ff:fe54:dc25: icmp_seq=2 ttl=255 time=182 ms
    64 bytes from 2002::65:24ff:fe54:dc25: icmp_seq=3 ttl=255 time=157 ms

    My radvd.conf looks like:

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

    route -6 -n shows me:

    root@raspberrypi:/home/pi# route -6 -n
    Kernel IPv6 routing table
    Destination Next Hop Flag Met Ref Use If
    ::/96 :: Un 256 2 1 6to4
    2001::/16 :: U 256 2 5 6to4
    2002::/64 :: U 256 2 6 bt0
    fe80::/64 :: U 256 1 0 eth0
    fe80::/64 :: U 256 1 0 bt0
    ::/0 ::192.88.99.1 UG 1024 1 0 6to4
    ::/0 :: !n -1 1 28 lo
    ::1/128 :: Un 0 6 22 lo
    ::10.160.8.14/128 :: Un 0 2 0 6to4
    2001::/128 :: Un 0 2 0 6to4
    2001:aa0:80e::1/128 :: Un 0 2 0 6to4
    2002::/128 :: Un 0 2 0 bt0
    2002::1/128 :: Un 0 4 7 bt0
    fe80::/128 :: Un 0 2 0 eth0
    fe80::/128 :: Un 0 2 0 bt0
    fe80::b827:ebff:fe36:c0bb/128 :: Un 0 4 2 bt0
    fe80::ba27:ebff:fe9c:6a11/128 :: Un 0 2 0 eth0
    ff00::/8 :: U 256 4 25 eth0
    ff00::/8 :: U 256 1 0 wlan0
    ff00::/8 :: U 256 5 34 bt0
    ff00::/8 :: U 256 1 0 6to4
    ::/0 :: !n -1 1 28 lo

    ifconfig shows me:

    root@raspberrypi:/home/pi# ifconfig
    6to4: flags=193<UP,RUNNING,NOARP> mtu 1480
    inet6 ::10.160.8.14 prefixlen 96 scopeid 0x80<compat,global>
    inet6 2001:aa0:80e::1 prefixlen 16 scopeid 0x0<global>
    sit txqueuelen 1000 (IPv6-in-IPv4)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 4 dropped 0 overruns 0 carrier 0 collisions 0

    bt0: flags=4161<UP,RUNNING,MULTICAST> mtu 1280
    inet6 2002::1 prefixlen 64 scopeid 0x0<global>
    inet6 fe80::b827:ebff:fe36:c0bb prefixlen 64 scopeid 0x20<link>
    unspec B8-27-EB-36-C0-BB-30-30-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
    RX packets 13 bytes 805 (805.0 B)
    RX errors 0 dropped 2 overruns 0 frame 0
    TX packets 49 bytes 4595 (4.4 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.160.8.14 netmask 255.255.240.0 broadcast 10.160.15.255
    inet6 fe80::ba27:ebff:fe9c:6a11 prefixlen 64 scopeid 0x20<link>
    ether b8:27:eb:9c:6a:11 txqueuelen 1000 (Ethernet)
    RX packets 71963 bytes 3975733 (3.7 MiB)
    RX errors 0 dropped 16 overruns 0 frame 0
    TX packets 127886 bytes 188319564 (179.5 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 1000 (Local Loopback)
    RX packets 60 bytes 3000 (2.9 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 60 bytes 3000 (2.9 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    ether b8:27:eb:c9:3f:44 txqueuelen 1000 (Ethernet)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    root@raspberrypi:/home/pi# service radvd restart
    root@raspberrypi:/home/pi# ifconfig
    6to4: flags=193<UP,RUNNING,NOARP> mtu 1480
    inet6 ::10.160.8.14 prefixlen 96 scopeid 0x80<compat,global>
    inet6 2001:aa0:80e::1 prefixlen 16 scopeid 0x0<global>
    sit txqueuelen 1000 (IPv6-in-IPv4)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 4 dropped 0 overruns 0 carrier 0 collisions 0

    bt0: flags=4161<UP,RUNNING,MULTICAST> mtu 1280
    inet6 2002::1 prefixlen 64 scopeid 0x0<global>
    inet6 fe80::b827:ebff:fe36:c0bb prefixlen 64 scopeid 0x20<link>
    unspec B8-27-EB-36-C0-BB-30-30-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
    RX packets 13 bytes 805 (805.0 B)
    RX errors 0 dropped 2 overruns 0 frame 0
    TX packets 51 bytes 4721 (4.6 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.160.8.14 netmask 255.255.240.0 broadcast 10.160.15.255
    inet6 fe80::ba27:ebff:fe9c:6a11 prefixlen 64 scopeid 0x20<link>
    ether b8:27:eb:9c:6a:11 txqueuelen 1000 (Ethernet)
    RX packets 72190 bytes 4009629 (3.8 MiB)
    RX errors 0 dropped 17 overruns 0 frame 0
    TX packets 127918 bytes 188325380 (179.6 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 1000 (Local Loopback)
    RX packets 60 bytes 3000 (2.9 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 60 bytes 3000 (2.9 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    ether b8:27:eb:c9:3f:44 txqueuelen 1000 (Ethernet)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    And the nRF-subscriber tells me:

    [00]<info> app: Application started.
    <info> app: Physical layer in connectable mode.
    <info> app: Physical layer: connected.
    <info> app: IPv6 Interface Up.
    <info> app: mqtt: error FFFFFFFC

    The last line comes from me, as mentioned above.

Reply
  • I have followed the instructions from your link exactly and still come to the same error. :(

    I really hope somebody can help me, because I'm hanging on to the problem for a week and I'm running out of ideas.

    Here are all informations about my setup

    I'm using the nRF52840-Preview-DK running the example:
    SDK\nRF5_SDK_15.0.0_a53641a\examples\iot\mqtt\lwip\subscriber
    I only adapted the IPv6-Broker address and changed the output of the error code.

    I tried with two versions of Raspbian:

    stretch (Linux version 4.14.34-7v+)
    jessie (Linux version 4.9.35-v7+)

    Both on a Pi 3 Model B with the intern BLE

     

    I'm able to ping the BT device:

    root@raspberrypi:/home/pi# ping6 2002::65:24ff:fe54:dc25
    PING 2002::65:24ff:fe54:dc25(2002::65:24ff:fe54:dc25) 56 data bytes
    64 bytes from 2002::65:24ff:fe54:dc25: icmp_seq=1 ttl=255 time=256 ms
    64 bytes from 2002::65:24ff:fe54:dc25: icmp_seq=2 ttl=255 time=182 ms
    64 bytes from 2002::65:24ff:fe54:dc25: icmp_seq=3 ttl=255 time=157 ms

    My radvd.conf looks like:

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

    route -6 -n shows me:

    root@raspberrypi:/home/pi# route -6 -n
    Kernel IPv6 routing table
    Destination Next Hop Flag Met Ref Use If
    ::/96 :: Un 256 2 1 6to4
    2001::/16 :: U 256 2 5 6to4
    2002::/64 :: U 256 2 6 bt0
    fe80::/64 :: U 256 1 0 eth0
    fe80::/64 :: U 256 1 0 bt0
    ::/0 ::192.88.99.1 UG 1024 1 0 6to4
    ::/0 :: !n -1 1 28 lo
    ::1/128 :: Un 0 6 22 lo
    ::10.160.8.14/128 :: Un 0 2 0 6to4
    2001::/128 :: Un 0 2 0 6to4
    2001:aa0:80e::1/128 :: Un 0 2 0 6to4
    2002::/128 :: Un 0 2 0 bt0
    2002::1/128 :: Un 0 4 7 bt0
    fe80::/128 :: Un 0 2 0 eth0
    fe80::/128 :: Un 0 2 0 bt0
    fe80::b827:ebff:fe36:c0bb/128 :: Un 0 4 2 bt0
    fe80::ba27:ebff:fe9c:6a11/128 :: Un 0 2 0 eth0
    ff00::/8 :: U 256 4 25 eth0
    ff00::/8 :: U 256 1 0 wlan0
    ff00::/8 :: U 256 5 34 bt0
    ff00::/8 :: U 256 1 0 6to4
    ::/0 :: !n -1 1 28 lo

    ifconfig shows me:

    root@raspberrypi:/home/pi# ifconfig
    6to4: flags=193<UP,RUNNING,NOARP> mtu 1480
    inet6 ::10.160.8.14 prefixlen 96 scopeid 0x80<compat,global>
    inet6 2001:aa0:80e::1 prefixlen 16 scopeid 0x0<global>
    sit txqueuelen 1000 (IPv6-in-IPv4)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 4 dropped 0 overruns 0 carrier 0 collisions 0

    bt0: flags=4161<UP,RUNNING,MULTICAST> mtu 1280
    inet6 2002::1 prefixlen 64 scopeid 0x0<global>
    inet6 fe80::b827:ebff:fe36:c0bb prefixlen 64 scopeid 0x20<link>
    unspec B8-27-EB-36-C0-BB-30-30-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
    RX packets 13 bytes 805 (805.0 B)
    RX errors 0 dropped 2 overruns 0 frame 0
    TX packets 49 bytes 4595 (4.4 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.160.8.14 netmask 255.255.240.0 broadcast 10.160.15.255
    inet6 fe80::ba27:ebff:fe9c:6a11 prefixlen 64 scopeid 0x20<link>
    ether b8:27:eb:9c:6a:11 txqueuelen 1000 (Ethernet)
    RX packets 71963 bytes 3975733 (3.7 MiB)
    RX errors 0 dropped 16 overruns 0 frame 0
    TX packets 127886 bytes 188319564 (179.5 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 1000 (Local Loopback)
    RX packets 60 bytes 3000 (2.9 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 60 bytes 3000 (2.9 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    ether b8:27:eb:c9:3f:44 txqueuelen 1000 (Ethernet)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    root@raspberrypi:/home/pi# service radvd restart
    root@raspberrypi:/home/pi# ifconfig
    6to4: flags=193<UP,RUNNING,NOARP> mtu 1480
    inet6 ::10.160.8.14 prefixlen 96 scopeid 0x80<compat,global>
    inet6 2001:aa0:80e::1 prefixlen 16 scopeid 0x0<global>
    sit txqueuelen 1000 (IPv6-in-IPv4)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 4 dropped 0 overruns 0 carrier 0 collisions 0

    bt0: flags=4161<UP,RUNNING,MULTICAST> mtu 1280
    inet6 2002::1 prefixlen 64 scopeid 0x0<global>
    inet6 fe80::b827:ebff:fe36:c0bb prefixlen 64 scopeid 0x20<link>
    unspec B8-27-EB-36-C0-BB-30-30-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
    RX packets 13 bytes 805 (805.0 B)
    RX errors 0 dropped 2 overruns 0 frame 0
    TX packets 51 bytes 4721 (4.6 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.160.8.14 netmask 255.255.240.0 broadcast 10.160.15.255
    inet6 fe80::ba27:ebff:fe9c:6a11 prefixlen 64 scopeid 0x20<link>
    ether b8:27:eb:9c:6a:11 txqueuelen 1000 (Ethernet)
    RX packets 72190 bytes 4009629 (3.8 MiB)
    RX errors 0 dropped 17 overruns 0 frame 0
    TX packets 127918 bytes 188325380 (179.6 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 1000 (Local Loopback)
    RX packets 60 bytes 3000 (2.9 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 60 bytes 3000 (2.9 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    ether b8:27:eb:c9:3f:44 txqueuelen 1000 (Ethernet)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    And the nRF-subscriber tells me:

    [00]<info> app: Application started.
    <info> app: Physical layer in connectable mode.
    <info> app: Physical layer: connected.
    <info> app: IPv6 Interface Up.
    <info> app: mqtt: error FFFFFFFC

    The last line comes from me, as mentioned above.

Children
No Data
Related