Help with CoAP Client Sample on nRF9160 DK Using Jio NB-IoT SIM

Hi Nordic team,

I'm using the nRF9160 DK with nRF Connect SDK v2.9.1, and trying to run the coap_client sample to send a GET request to the public CoAP test server at coap.me (IP: 134.102.218.18), targeting the resource path /hello.

I'm using a Jio NB-IoT SIM for LTE connectivity.

I’ve configured the sample as follows:

Enabled CONFIG_COAP_CLIENT=y

Set CONFIG_COAP_SERVER_HOSTNAME="coap.me"

Set CONFIG_COAP_SERVER_PORT=5683

Enabled CONFIG_LTE_LINK_CONTROL=y and CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

Using conn_mgr to establish the LTE connection before sending the CoAP request

I would like to ask:

Is there anything specific I need to change to get communication working with a CoAP server like coap.me?

Has anyone successfully used NB-IoT (especially with Jio SIM) to send CoAP requests over UDP?

Are there any known limitations or additional requirements for using NB-IoT for CoAP communication?

Thanks and regards,
Arun

Parents
  • Let me recommend:

    First check, if the modem registers successful to a network, e.g. enable the modem trace and use the cellular monitor.

    Does it register? If not, it's related to you SIM card and the available networks.

    > Has anyone successfully used NB-IoT (especially with Jio SIM) to send CoAP requests over UDP?

    Not with that SIM. With a couple of other SIMs, if there is a subscribed NB-IoT network reachable, it works. UDP is nothing special on that level. I use CoAP via cellular (nRF9160) for a couple of years. It's superior in terms of data-volume and energy, especially, if encryption is required, DTLS 1.2 CID does a good job (RFC9146, I'm one of the co-autors, so I'm biased).

  • Hi,

    My setup:

    • LTE network registration is successful

    • DNS resolution of coap.me works

    • IPv4 address is found

    • But the CoAP request fails with error: -114 (ENETUNREACH)

      Has anyone successfully sent UDP CoAP packets using any Indian NB-IoT SIM (Vodafone, BSNL, etc.)?

  • Your using NCS 2.9.1 and the "nrf/samples/net/coap_client"?

    You only modified the COAP_SAMPLE_SERVER_HOSTNAME and COAP_SAMPLE_RESOURCE?

    (CONFIG_LTE_AUTO_INIT_AND_CONNECT isn't longer valid for NCS 2.9.1).

    build with:

    west build -d build_nrf9160dk_nrf9160_ns -b nrf9160dk/nrf9160/ns --pristine -- -DCONFIG_COAP_SAMPLE_SERVER_HOSTNAME='"coap.me"' -DCONFIG_COAP_SAMPLE_RESOURCE='"hello"'

    log:

    *** Booting nRF Connect SDK v2.9.1-60d0d6c8d42d ***
    *** Using Zephyr OS v3.7.99-ca954a6216c9 ***
    [00:00:00.361,267] <inf> coap_client_sample: The CoAP client sample started
    [00:00:00.361,297] <inf> coap_client_sample: Bringing network interface up and connecting to the network
    [00:00:00.639,953] <inf> coap_client_sample: Waiting for network connectivity
    [00:00:04.856,750] <inf> coap_client_sample: Network connectivity established
    [00:00:11.097,595] <inf> coap_client_sample: Network connectivity lost
    [00:00:12.389,495] <err> coap_client_sample: getaddrinfo, error: -11
    [00:00:12.389,526] <err> coap_client_sample: Failed to resolve server name
    [00:00:12.389,556] <err> coap_client_sample: periodic_coap_request_loop, error: -11
    [00:00:12.389,556] <err> coap_client_sample: Fatal error! Rebooting the device.
    *** Booting nRF Connect SDK v2.9.1-60d0d6c8d42d ***
    *** Using Zephyr OS v3.7.99-ca954a6216c9 ***
    [00:00:00.253,875] <inf> coap_client_sample: The CoAP client sample started
    [00:00:00.253,906] <inf> coap_client_sample: Bringing network interface up and connecting to the network
    [00:00:00.532,379] <inf> coap_client_sample: Waiting for network connectivity
    [00:00:04.866,058] <inf> coap_client_sample: Network connectivity established
    [00:00:12.886,718] <inf> coap_client_sample: Network connectivity lost
    [00:00:15.669,952] <inf> coap_client_sample: Network connectivity established
    [00:00:16.224,029] <inf> coap_client_sample: IPv4 Address found 134.102.218.18
    [00:00:16.224,304] <inf> coap_client_sample: Initializing CoAP client
    [00:00:16.225,921] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:16.312,255] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:21.267,181] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:22.056,579] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:26.308,471] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:26.887,603] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:31.349,761] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:31.965,087] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:36.391,082] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:37.008,239] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:41.432,403] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:42.005,462] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:46.473,693] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:47.044,525] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:51.515,014] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:52.085,845] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:00:56.556,335] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:00:58.556,243] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:01:01.597,656] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:01:02.214,294] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world
    [00:01:06.638,977] <inf> coap_client_sample: CoAP GET request sent sent to coap.me, resource: hello
    [00:01:07.635,589] <inf> coap_client_sample: CoAP response: code: 0x45, payload: world

  • If DNS works (that works also over UDP), CoAP should work as well.

    I will setup the sample to provide a modem trace, seems that the sample is not "up-to-date" for that. 

  • Thank you. Yes  DNS resolves correctly, and I get the IPv4 address for coap.me, but the CoAP GET request fails with error -114.

    That’s why I suspect the issue may be that Jio’s NB-IoT network allows DNS (UDP port 53), but blocks CoAP (UDP port 5683) or general UDP traffic to public servers.

    I'm looking forward to your updated sample with modem trace support — it will help confirm what's happening at the modem level.

    Just to clarify, is this issue definitely due to my SIM/network, or is there still a chance it could be a configuration issue?

    Please let me know once the updated sample is available. 

    Thanks again for your help!

Reply
  • Thank you. Yes  DNS resolves correctly, and I get the IPv4 address for coap.me, but the CoAP GET request fails with error -114.

    That’s why I suspect the issue may be that Jio’s NB-IoT network allows DNS (UDP port 53), but blocks CoAP (UDP port 5683) or general UDP traffic to public servers.

    I'm looking forward to your updated sample with modem trace support — it will help confirm what's happening at the modem level.

    Just to clarify, is this issue definitely due to my SIM/network, or is there still a chance it could be a configuration issue?

    Please let me know once the updated sample is available. 

    Thanks again for your help!

Children
  • That’s why I suspect the issue may be that Jio’s NB-IoT network allows DNS (UDP port 53), but blocks CoAP (UDP port 5683) or general UDP traffic to public servers.

    Blocking UDP port is quite uncommon.

    There may be a lot of reasons, therefore the modem trace or capture.

    From the board conf.

    # Disable Duplicate Address Detection (DAD)
    # due to not being properly implemented for offloaded interfaces.
    CONFIG_NET_IPV6_NBR_CACHE=n
    CONFIG_NET_IPV6_MLD=n

    Not sure, if your SIM uses IPv6 instead of IPv4. There are several pretty nasty consequences, as that comment already points to. Here in Europe quite a lot is only supporting IPv4 and so are also many samples only support IPv4. Even if it turns out, that it is related to IPv6, I will not be of too much help, because my SIMs gets only IPv4 ;-). But then maybe someone from Nordic jumps in.  

Related