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:
Hopefully someone here can explain to me why I am not getting any responses or help me get my responses.