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

Configure openthread for mqtt - tcp connection times out?

Hi, I am in need of some guidance.

The overall goal is to set up MQTT/TLS communication from end devices in a thread network, via a border router to the AWS cloud.

I have my nrf52840DK up and running in the thread network, it has got a IPv6 address from the border router (a KiBRA KTBRN1) via DHCPv6 and I am able to ping in both directions.

My problem is that the TCP connection is not setup correctly and I suspect that I have missed something in the configuration.

on my dev pc:

ubuntu:~$ ifconfig | grep inet
inet 192.168.1.49 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fd47:d3c:923f:0:20c:29ff:fe88:7ce1 prefixlen 64 scopeid 0x0<global>

ubuntu:~$ ping -6 -c2 fd7e:b200:ced:0:0:0:a2e:24
PING fd7e:b200:ced:0:0:0:a2e:24(fd7e:b200:ced::a2e:24) 56 data bytes
64 bytes from fd7e:b200:ced::a2e:24: icmp_seq=1 ttl=63 time=42.5 ms
64 bytes from fd7e:b200:ced::a2e:24: icmp_seq=2 ttl=63 time=39.0 ms

--- fd7e:b200:ced:0:0:0:a2e:24 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 39.054/40.793/42.532/1.739 ms

ubuntu:~$ nc -l 1234

Then on the thread device:

uart:~$ ot ipaddr
fd7e:b200:ced:0:0:0:a2e:24
fdd9:20b7:f073:0:0:ff:fe00:1800
fdd9:20b7:f073:0:597f:71e6:d5f5:3775
fe80:0:0:0:b849:ed15:1dba:12ab
Done

uart:~$ ot ping 64:ff9b::c0a8:131
Done
16 bytes from 64:ff9b:0:0:0:0:c0a8:131: icmp_seq=1 hlim=63 time=57ms

uart:~$ ot ping fd47:d3c:923f:0:20c:29ff:fe88:7ce1
Done
16 bytes from fd47:d3c:923f:0:20c:29ff:fe88:7ce1: icmp_seq=2 hlim=63 time=58ms
uart:~$

uart:~$ net ping 64:ff9b::c0a8:131
PING 64:ff9b::c0a8:131
8 bytes from 64:ff9b::c0a8:131 to fd7e:b200:ced::a2e:24: icmp_seq=0 ttl=63 rssi=0 time=88.50 ms
8 bytes from 64:ff9b::c0a8:131 to fd7e:b200:ced::a2e:24: icmp_seq=1 ttl=63 rssi=0 time=87.65 ms
8 bytes from 64:ff9b::c0a8:131 to fd7e:b200:ced::a2e:24: icmp_seq=2 ttl=63 rssi=0 time=87.40 ms

uart:~$ net ping fd47:d3c:923f:0:20c:29ff:fe88:7ce1
PING fd47:d3c:923f:0:20c:29ff:fe88:7ce1
8 bytes from fd47:d3c:923f:0:20c:29ff:fe88:7ce1 to fd7e:b200:ced::a2e:24: icmp_seq=0 ttl=63 rssi=0 time=88.17 ms
8 bytes from fd47:d3c:923f:0:20c:29ff:fe88:7ce1 to fd7e:b200:ced::a2e:24: icmp_seq=1 ttl=63 rssi=0 time=114.07 ms
8 bytes from fd47:d3c:923f:0:20c:29ff:fe88:7ce1 to fd7e:b200:ced::a2e:24: icmp_seq=2 ttl=63 rssi=0 time=88.01 ms

So far it looks good, but when I try to open a tcp connection it fails.

uart:~$ net tcp connect fd47:d3c:923f:0:20c:29ff:fe88:7ce1 1234
Connecting from [fd7e:b200:ced::a2e:24]:0 to [fd47:d3c:923f:0:20c:29ff:fe88:7ce1]:1234
uart:~$

Here is the debuglog:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
D: (shell_uart): conn: 0x2001b780, ref_count: 1
D: (shell_uart): conn: 0x2001b780
D: (shell_uart): Context 0x2000c3e0 binding to TCP [fd7e:b200:ced::a2e:24]:35896 iface 0x200008e4
D: (shell_uart): context: 0x2000c3e0, local: fd7e:b200:ced::a2e:24, remote: fd47:d3c:923f:0:20c:29ff:fe88:7ce1
D: (shell_uart): conn: 0x2001b780 src: fd7e:b200:ced::a2e:24, dst: fd47:d3c:923f:0:20c:29ff:fe88:7ce1
D: (shell_uart): [0x2000c8d8/6/2/0x7f] remote fd47:d3c:923f:0:20c:29ff:fe88:7ce1/1234
D: (shell_uart): local fd7e:b200:ced::a2e:24/35896 cb 0x19ea9 ud 0x2000c3e0
D: (shell_uart): [LISTEN Seq=3781784924 Ack=0]
D: (shell_uart): On iface 0x200008e4 size 20
D: (shell_uart): HDRs length estimation 68
D: (shell_uart): Data allocation maximum size 88 (requested 20)
D: (shell_uart): TDATA (?) [0] frag 0x20019d58 ref 1 (tcp_out_ext():776)
D: (shell_uart): pkt 0x20018ad0 data 0x20019fc0 length 40
D: (shell_uart): pkt 0x20018ad0 skip 40
D: (shell_uart): pkt 0x20018ad0 data 0x20019fe8 length 20
D: (shell_uart): pkt 0x20018ad0 skip 20
D: (shell_uart): pkt 0x20018ad0 data 0x20019fc0 length 40
D: (shell_uart): pkt 0x20018ad0 skip 40
D: (shell_uart): pkt 0x20018ad0 skip 8
D: (shell_uart): pkt 0x20018ad0 skip 32
D: (shell_uart): pkt 0x20018ad0 data 0x20019fe8 length 20
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

My configuration

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
CONFIG_GPIO=y
CONFIG_FPU=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_MBEDTLS_HEAP_SIZE=10240
CONFIG_OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE=1024
# CONFIG_MBEDTLS_CIPHER_MODE_CBC is not set
# CONFIG_MBEDTLS_CIPHER_MODE_CTR is not set
# CONFIG_MBEDTLS_CHACHA20_C is not set
# CONFIG_MBEDTLS_POLY1305_C is not set
# CONFIG_MBEDTLS_DHM_C is not set
# CONFIG_MBEDTLS_RSA_C is not set
# CONFIG_MBEDTLS_SHA1_C is not set
# CONFIG_MBEDTLS_SHA512_C is not set
CONFIG_OPENTHREAD_LIBRARY_1_1=y
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_ARM_MPU=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX