CoAP Response on OpenThread network

Hello Devzone,

I've got a problem with receiving a CoAP response using the CoAP client. I've tried both the OpenThread CoAP client example and the Zephyr net/coap_client

I am working with a nrf52840 on a openthread network and I am sending a CoAP GET request to the CoAP server on the local network. See logs below

I can see the GET request arrive on the server. However the response payload never arrives. The CoAP Receive thread should receive the response for the GET request by polling the socket, but the poll only returns on timeout. I also tried to run as a full thread device instead of a MTD_SED.

CoAP Client Logs:

[00:00:00.003,234] <inf> ieee802154_nrf5: nRF5 802154 radio initialized
[00:00:00.003,448] <dbg> net_if: net_if_init: (main): 
[00:00:00.003,479] <dbg> net_if: init_iface: (main): On iface 0x200009e0
[00:00:00.008,972] <inf> fs_nvs: 8 Sectors of 4096 bytes
[00:00:00.008,972] <inf> fs_nvs: alloc wra: 3, e08
[00:00:00.009,002] <inf> fs_nvs: data wra: 3, 5d0
[00:00:00.120,056] <dbg> net_if: update_operational_state: (main): iface 0x200009e0, oper state DOWN admin DOWN carrier ON dormant ON
[00:00:00.192,901] <inf> net_l2_openthread: State changed! Flags: 0x1017c310 Current role: disabled
[00:00:00.192,993] <dbg> net_if: net_if_ipv6_calc_reachable_time: (main): min_reachable:15000 max_reachable:45000
[00:00:00.193,298] <dbg> net_if: net_if_post_init: (main): 
[00:00:00.193,328] <dbg> net_if: net_if_up: (main): iface 0x200009e0
[00:00:00.193,481] <dbg> net_if: update_operational_state: (main): iface 0x200009e0, oper state DORMANT admin UP carrier ON dormant ON
*** Booting nRF Connect SDK v3.5.99-ncs1 ***
[00:00:00.193,817] <inf> coap_client: Start CoAP-client sample
[00:00:00.194,122] <dbg> net_sock: zsock_socket_internal: (main): socket: ctx=0x2000daa8, fd=0
[00:00:00.194,305] <dbg> coap_utils: coap_init: CoAP socket receive thread started
[00:00:00.471,099] <inf> net_l2_openthread: State changed! Flags: 0x10000000 Current role: disabled
[00:00:00.497,467] <inf> net_l2_openthread: State changed! Flags: 0x10000000 Current role: disabled
[00:00:00.497,558] <inf> net_l2_openthread: OpenThread version: OPENTHREAD/b9dcdbca4; Zephyr; Apr  4 2024 13:54:50
[00:00:00.524,475] <inf> net_l2_openthread: Network name: NEST-PAN-5961
[00:00:00.524,597] <inf> [N] Mle-----------: Role disabled -> detached
[00:00:00.608,947] <inf> net_l2_openthread: State changed! Flags: 0x0100102d Current role: detached
[00:00:00.609,100] <dbg> net_if: net_if_ipv6_addr_add: (openthread): [0] interface 0x200009e0 address fd8b:bdd9:ef0b:0:ac61:2288:69ac:99e7 type AUTO added
[00:00:00.609,222] <dbg> net_if: net_if_ipv6_addr_add: (openthread): [1] interface 0x200009e0 address fe80::8011:cc6c:55c8:fd55 type AUTO added
[00:00:00.609,344] <dbg> net_if: net_if_ipv6_maddr_add: (openthread): [0] interface 0x200009e0 address ff33:40:fd8b:bdd9:ef0b::1 added
[00:00:00.609,466] <dbg> net_if: net_if_ipv6_maddr_add: (openthread): [1] interface 0x200009e0 address ff32:40:fd8b:bdd9:ef0b::1 added
[00:00:00.609,588] <dbg> net_if: net_if_ipv6_maddr_add: (openthread): [2] interface 0x200009e0 address ff02::1 added
[00:00:00.609,710] <dbg> net_if: net_if_ipv6_maddr_add: (openthread): [3] interface 0x200009e0 address ff03::1 added
[00:00:00.732,269] <inf> [N] Mle-----------: Role detached -> child
[00:00:00.800,659] <inf> net_l2_openthread: State changed! Flags: 0x00000084 Current role: child
[00:00:00.800,811] <dbg> net_if: update_operational_state: (openthread): iface 0x200009e0, oper state UP admin UP carrier ON dormant OFF
[00:00:00.995,178] <inf> net_l2_openthread: State changed! Flags: 0x00000200 Current role: child
[00:00:00.995,300] <inf> net_l2_openthread: State changed! Flags: 0x00000001 Current role: child
[00:00:00.995,422] <dbg> net_if: net_if_ipv6_addr_add: (openthread): [2] interface 0x200009e0 address fd18:4eca:5e5d:1:4751:5a24:f860:6538 type AUTO added
[00:00:05.802,429] <inf> coap_client_utils: Poll Period: 100ms set
[00:00:05.802,520] <inf> coap_client_utils: Send 'provisioning' request
[00:00:05.803,131] <dbg> net_if: net_if_tx: (): Processing (pkt 0x2002acbc, prio 0) network packet iface 0x200009e0/1
[00:00:05.803,833] <dbg> net_if: net_if_tx: (): Calling context send cb 0x2000daa8 status 68

When I ping the nrf52840 from my laptop I dont seem to be able to reach it until I restart the CoAP client and all pings go through.

Ping CoAP Client after restarting:

ping fd18:4eca:5e5d:1:4751:5a24:f860:6538

PING fd18:4eca:5e5d:1:4751:5a24:f860:6538 (fd18:4eca:5e5d:1:4751:5a24:f860:6538) 56 data bytes

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=31 ttl=62 time=29777 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=32 ttl=62 time=28798 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=33 ttl=62 time=27809 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=60 ttl=62 time=474 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=34 ttl=62 time=26975 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=35 ttl=62 time=25983 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=36 ttl=62 time=25041 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=37 ttl=62 time=24037 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=38 ttl=62 time=23080 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=39 ttl=62 time=22078 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=40 ttl=62 time=21096 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=41 ttl=62 time=20126 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=42 ttl=62 time=19153 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=43 ttl=62 time=18181 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=44 ttl=62 time=17201 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=45 ttl=62 time=16218 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=46 ttl=62 time=15302 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=47 ttl=62 time=14296 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=48 ttl=62 time=13312 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=49 ttl=62 time=12335 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=50 ttl=62 time=11392 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=51 ttl=62 time=10396 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=52 ttl=62 time=9424 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=53 ttl=62 time=8458 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=54 ttl=62 time=7498 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=55 ttl=62 time=6515 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=56 ttl=62 time=5554 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=57 ttl=62 time=4560 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=58 ttl=62 time=3578 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=59 ttl=62 time=2585 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=61 ttl=62 time=580 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=62 ttl=62 time=3106 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=63 ttl=62 time=2158 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=64 ttl=62 time=1152 ms

64 bytes from fd18:4eca:5e5d:1:4751:5a24:f860:6538: icmp_seq=65 ttl=62 time=154 ms

When I tried to run the CoAP example on the nrf7002 over wifi I do get responses and everything works as expected.

OpenThread CoAP example project:

8168.coap_client_test.zip

Hopefully someone here can explain to me why I am not getting any responses or help me get my responses.

Parents
  • Hi Frank,

    Is your current network topology looks like below? 

    The current CoAP client is not directly designed for this topology. Can you test with Thread: CLI — nRF Connect SDK 2.6.0 documentation (nordicsemi.com) instead?

    It also supports run as CoAP client and provide more commands that can help to get debugging information.

    Best regards,

    Charlie

  • Hello Charlie,

    Yes this topology is accurate, the CoAP server and client on the wifi LAN are working as expected. With the CoAP client on the Thread network having problems receiving a response.

    I just ran the same GET request with the CLI example with the same timeouts

    uart:~$ ot coap get 2001:0db8:1234:0001:3685:18ff:fe7e:7e8c example
    Done
    uart:~$ ot coap get 2001:0db8:1234:0001:3685:18ff:fe7e:7e8c example
    Done
    \uart:~$ ot coap get 2001:0db8:1234:0001:3685:18ff:fe7e:7e8c example
    Done
    coap receive response error 28: ResponseTimeout
    coap receive response error 28: ResponseTimeout
    coap receive response error 28: ResponseTimeout

  • Are you able to ping CoAP server from CLI ?

    openthread/src/cli/README.md at main · openthread/openthread (github.com)

    It seems has connection issue. OTBR may not set correctly.

    Best regards,

    Charlie

  • I do see the CoAP GET request arrive on the CoAP server.

    The ping packet is indeed lost when I ping from the CLI

    uart:~$ ot ping 2001:0db8:1234:0001:3685:18ff:fe7e:7e8c
    1 packets transmitted, 0 packets received. Packet loss = 100.0%.
    Done
    uart:~$ ot ping 2001:0db8:1234:0001:3685:18ff:fe7e:7e8c
    1 packets transmitted, 0 packets received. Packet loss = 100.0%.
    Done
    uart:~$ ot ping 2001:0db8:1234:0001:3685:18ff:fe7e:7e8c
    1 packets transmitted, 0 packets received. Packet loss = 100.0%.
    Done

    The OTBR is a NestHub 2

    **Edit**

    Pinging my laptop from the CLI works

    uart:~$ ot ping 2001:db8:1234:1:594b:8731:6f7e:6f5a
    16 bytes from 2001:db8:1234:1:594b:8731:6f7e:6f5a: icmp_seq=6 hlim=63 time=25ms
    1 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 25/25.0/25 ms.
    Done
    uart:~$ ot ping 2001:db8:1234:1:594b:8731:6f7e:6f5a
    16 bytes from 2001:db8:1234:1:594b:8731:6f7e:6f5a: icmp_seq=7 hlim=63 time=21ms
    1 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 21/21.0/21 ms.
    Done
    uart:~$ ot ping 2001:db8:1234:1:594b:8731:6f7e:6f5a
    16 bytes from 2001:db8:1234:1:594b:8731:6f7e:6f5a: icmp_seq=8 hlim=63 time=23ms
    1 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 23/23.0/23 ms.
    Done

    Pinging the CLI from my laptop works

     ping fd18:4eca:5
    e5d:1:cb76:eb4e:261b:7151
    PING fd18:4eca:5e5d:1:cb76:eb4e:261b:7151 (fd18:4eca:5e5d:1:cb76:eb4e:261b:7151) 56 data bytes
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=1 ttl=63 time=37.7 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=2 ttl=63 time=30.7 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=3 ttl=63 time=25.9 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=4 ttl=63 time=27.7 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=5 ttl=63 time=25.9 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=6 ttl=63 time=25.2 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=7 ttl=63 time=26.4 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=8 ttl=63 time=25.8 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=9 ttl=63 time=28.2 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=10 ttl=63 time=38.9 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=11 ttl=63 time=26.8 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=12 ttl=63 time=30.1 ms
    64 bytes from fd18:4eca:5e5d:1:cb76:eb4e:261b:7151: icmp_seq=13 ttl=63 time=26.9 ms
    ^C
    --- fd18:4eca:5e5d:1:cb76:eb4e:261b:7151 ping statistics ---
    13 packets transmitted, 13 received, 0% packet loss, time 12014ms
    rtt min/avg/max/mdev = 25.172/28.943/38.932/4.298 ms

    I think I will try a CoAP Server on my laptop, and see if that has the same problem or not.

  • Ok, good to know you are using NestHub 2. We are still using RPI based OTBR in the development.

    You mentioned your laptop could ping CoAP client(nRF52840) when it restarts. Do this still work for your CoAP server(is it running on your laptop?) + CLI?

    Best regards,

    Charlie

  • Ok, I just see your **Edit** content. It explains my questions.

Reply Children
Related