OpenThread and MQTT over TLS is single program.

Hi,

I use nrf52840 processor with esp32c3 as WiFi modem. I need to run OpenThread network and MQTT client on these processors. When I run only OpenThread network, it works correctly. When I run only MQTT client via WiFi, it works correctly too. But when I try to merge this two programs into one, only unencrypted MQTT works.

When I try to transfer some data via OpenThread network I get this error:
<err> coap_utils: Failed to create socket 106

And when I try to connect to MQTT broker over TLS I get this error:

<err> net_sock_tls: TLS handshake error: -7780
<err> net_sock: invalid access on sock 0 by thread 0x2000137


Here is my OpenThread program: https://github.com/Whirla/whbr_demos/tree/main/whbr_ot_coap
Here is my MQTT program: https://github.com/Whirla/whbr_demos/tree/main/whbr_wifi_mqtt

Here is merged program: https://github.com/Whirla/whbr_demos/tree/main/whbr_both
And here is a hardware I use: https://github.com/gblach/HexGateway

Could you point me out why encryption is not working in my program?

Parents Reply
  • I didn't found any other options other than CONFIG_WIFI_ESP_AT that cause this issue. But I found -EAFNOSUPPORT cames from drivers/wifi/esp_at/esp_offload.c:608 because family variable has the same value that I pass to coap_init() function.

    I've added /boards/nrf52840dk_nrf52840.overlay to OpenThread only sample, so you can reproduce this issue on nrf52840dk. You don't need to have esp32c3 connected, because it is not used by this program, only driver is enabled.

    When you send CoAP messages over OpenThread, where do you send the data to? (another node in the network, or an external server)

    I'm trying to send data to another node in the same OT network.

    Is IPv6 still supported after you select CONFIG_WIFI_ESP_AT?

    "net iface" command shows that OpenThread interface has assigned seven IPv6 addresses:

    rtt:~$ net iface

    Interface 0x20000a08 (IP Offload) [1]
    =====================================
    Interface is down.

    Interface 0x20000a14 (OpenThread) [2]
    =====================================
    Link addr : F4:CE:36:EF:04:8D:D0:E1
    MTU       : 1280
    Flags     : AUTO_START,IPv4,IPv6
    IPv6 unicast addresses (max 6):
      fd04:93c0:e52a:0:fa7d:45d:d6e:95ca autoconf preferred infinite meshlocal
      fe80::b8e9:def7:b096:806c autoconf preferred infinite
    IPv6 multicast addresses (max 8):
      ff33:40:fd04:93c0:e52a::1
      ff32:40:fd04:93c0:e52a::1
      ff02::1
      ff03::1
      ff03::fc
      ff02::2
      ff03::2
    IPv6 prefixes (max 2):
      <none>
    IPv6 hop limit           : 64
    IPv6 base reachable time : 30000
    IPv6 reachable time      : 23751
    IPv6 retransmit timer    : 0
    IPv4 unicast addresses (max 1):
      <none>
    IPv4 multicast addresses (max 1):
      <none>

Children
Related