nRF9160 (Thingy91) not connecting to Lwm2m server as a lwm2m client.

Hi,

I am trying to connect to an LwM2M server using thingy91. I have Leshan demo-server hosted remotely on cloud it provides me IPv6 address to connect, as my network provider provides only IPv6. 

I have setup all the security configurations of the device on the server side as shown in the documentation. I have setup same credentials on the device side using credential management AT command and saved it to NVM.

I am using ncs v2.2.0. I changed server address and port, enabled CONFIG_NET_IPV6 in the prj.conf file of lwm2m_clinet project in samples. built and flashed the application to my device.

I am not able to connect to the  lwm2m server from my device.

Here are some of the logs:

[00:00:00.499,572] <err> ADXL362: wrong part_id: 0

*** Booting Zephyr OS build v3.2.99-ncs1 ***
[00:00:01.508,239] <inf> BH1749: BH1749 initialized
[00:00:01.513,366] <inf> app_lwm2m_client: Run LWM2M client
[00:00:01.513,397] <inf> app_lwm2m_client: Initializing modem.
[00:00:01.531,860] <inf> app_lwm2m_client: endpoint: urn:imei:35xxxxxxxxxxx22
[00:00:01.539,428] <dbg> app_lwm2m_buzzer: buzzer_intensity_cb: Intensity: 100
[00:00:01.539,611] <err> accelerometer: Accelerometer device not ready
[00:00:01.540,222] <inf> lwm2m_firmware: Image is not confirmed OK
[00:00:01.540,283] <inf> lwm2m_firmware: Marked image as OK
[00:00:01.540,283] <inf> app_lwm2m_client: Connecting to network.
[00:00:01.540,313] <inf> app_lwm2m_client: This may take several minutes.
[00:01:10.853,454] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 4
uart:~$

after 10 mins my device keeps retrying to connect to the server and network and fails, here are some of the logs device retrying to connect:

[00:10:01.585,540] <inf> lte_lc: Network connection attempt timed out
[00:10:01.597,320] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0
[00:10:01.599,121] <inf> lte_lc: Using fallback network mode
[00:10:03.202,117] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2
[00:10:11.526,977] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1
[00:10:11.527,832] <inf> app_lwm2m_client: Connected to NB-IoT network
[00:10:11.532,287] <inf> app_lwm2m_client: Client connect to server
[00:10:11.532,348] <inf> net_lwm2m_rd_client: Start LWM2M Client: urn:imei:35xxxxxxxxxx22
[00:10:11.867,736] <dbg> app_lwm2m_temp_sensor: app_event_handler: Temperature sensor event received: val1 = 000028, val2 = 030000
[00:10:11.867,950] <dbg> app_lwm2m_press_sensor: app_event_handler: Pressure sensor event received: val1 = 000090, val2 = 823000
[00:10:11.868,194] <dbg> app_lwm2m_humid_sensor: app_event_handler: Humidity sensor event received: val1 = 000050, val2 = 743000
[00:10:11.868,408] <dbg> app_lwm2m_gas_res_sensor: app_event_handler: Gas resistance sensor event received: val1 = 015170, val2 = 000000
[00:10:12.130,523] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:12.206,359] <inf> lwm2m_security: Need to write credentials, requesting LTE and GNSS offline...
[00:10:12.608,551] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0
[00:10:12.608,703] <inf> app_lwm2m_client: LwM2M is connecting to server
[00:10:13.385,620] <inf> lwm2m_security: Requesting LTE and GNSS online
[00:10:14.534,149] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2
[00:10:20.406,768] <inf> lwm2m_security: Modem connection restored
[00:10:20.407,287] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1
[00:10:20.407,562] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:20.407,714] <inf> app_lwm2m_client: LwM2M is connecting to server
[00:10:20.407,867] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:21.408,294] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:21.484,710] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:21.484,954] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:22.985,504] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:23.061,798] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:23.062,072] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:25.562,835] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:25.639,068] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:25.639,343] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:30.140,441] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:30.216,644] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:30.217,010] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:38.718,994] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:38.795,043] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:38.795,318] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:38.795,349] <err> app_lwm2m_client: LwM2M engine reported a network error.
[00:10:38.795,471] <inf> net_lwm2m_rd_client: Stop LWM2M Client: urn:imei:35xxxxxxxxxxx22
[00:10:39.295,684] <inf> app_lwm2m_client: LwM2M restart requested. The sample will try to re-establish network connection.
[00:10:39.650,299] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0
[00:10:39.829,681] <inf> app_lwm2m_client: Connecting to network.
[00:10:39.829,681] <inf> app_lwm2m_client: This may take several minutes.
[00:10:40.934,936] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2
[00:10:44.727,752] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1
[00:10:44.728,607] <inf> app_lwm2m_client: Connected to NB-IoT network
[00:10:44.728,637] <inf> app_lwm2m_client: Client connect to server
[00:10:44.728,698] <inf> net_lwm2m_rd_client: Start LWM2M Client: urn:imei:35xxxxxxxxxxx22
[00:10:45.297,271] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:45.373,413] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:45.373,687] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:46.374,114] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:46.450,439] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:46.450,683] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:47.951,232] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:48.027,435] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:48.027,709] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:50.528,442] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:50.604,614] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:50.604,888] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:10:55.029,113] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:10:55.105,621] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:55.105,895] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:11:03.606,872] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:11:03.683,197] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:11:03.683,471] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:11:03.683,502] <err> app_lwm2m_client: LwM2M engine reported a network error.
[00:11:03.683,624] <inf> net_lwm2m_rd_client: Stop LWM2M Client: urn:imei:35xxxxxxxxxxx22
[00:11:04.183,837] <inf> app_lwm2m_client: LwM2M restart requested. The sample will try to re-establish network connection.
[00:11:04.620,330] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0
[00:11:04.737,640] <inf> app_lwm2m_client: Connecting to network.
[00:11:04.737,670] <inf> app_lwm2m_client: This may take several minutes.
[00:11:05.895,385] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2
[00:11:11.608,551] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1
[00:11:11.609,375] <inf> app_lwm2m_client: Connected to NB-IoT network
[00:11:11.609,405] <inf> app_lwm2m_client: Client connect to server
[00:11:11.609,466] <inf> net_lwm2m_rd_client: Start LWM2M Client: urn:imei:35xxxxxxxxxxx22
[00:11:12.185,882] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:11:12.262,115] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:11:12.262,390] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:11:13.262,847] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:11:13.339,233] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:11:13.339,508] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:11:14.840,026] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:11:14.912,475] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:11:14.912,750] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:11:17.413,482] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:11:17.485,626] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:11:17.485,900] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:11:21.987,121] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:35xxxxxxxxxxx22' with client lifetime 30
[00:11:22.063,262] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:11:22.063,537] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)

Can anyone please help me to connect to my server through lwm2m.

Related