Thingy91 lwm2m FOTA update

Good day 

I am trying pull an update from our own server using lwm2m and have attempted to follow the steps accordingly.  The sample I'm using is the standard lwm2m client sample.  I seem to  be getting an error which is documented as a connection timeout.  Any ideas on what I need to do ?

2023-04-17T10:51:55.817Z DEBUG modem << [m[1;32muart:~$ [m[8D[J*** Booting Zephyr OS build v3.2.99-ncs2 ***
2023-04-17T10:51:55.822Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.507,812] [0m<inf> app_lwm2m_client: Run LWM2M client[0m
2023-04-17T10:51:55.826Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.507,812] [0m<inf> app_lwm2m_client: Initializing modem.[0m
2023-04-17T10:51:55.829Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.509,918] [0m<inf> BH1749: BH1749 initialized[0m
2023-04-17T10:51:55.833Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.524,810] [0m<inf> app_lwm2m_client: endpoint: urn:imei:******[0m
2023-04-17T10:51:55.836Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.571,014] [0m<dbg> app_lwm2m: buzzer_intensity_cb: Intensity: 100[0m
2023-04-17T10:51:57.900Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:03.572,448] [0m<inf> app_sensors: Finished accelerometer calibration[0m
2023-04-17T10:51:57.905Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.572,753] [0m<dbg> app_sensors: colour_sensor_create: Created IPSO Colour Sensor instance: 0[0m
2023-04-17T10:51:57.908Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.572,906] [0m<dbg> app_sensors: colour_sensor_create: Created IPSO Colour Sensor instance: 1[0m
2023-04-17T10:51:57.912Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.573,059] [0m<inf> lwm2m_lte_notification: Registering ncell notification handler[0m
2023-04-17T10:51:57.915Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.573,150] [0m<inf> lwm2m_firmware: Image is confirmed OK[0m
2023-04-17T10:51:57.919Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.582,031] [0m<inf> app_lwm2m_client: PSM mode requested[0m
2023-04-17T10:51:57.922Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.582,031] [0m<inf> app_lwm2m_client: Connecting to network.[0m
2023-04-17T10:51:57.925Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.582,061] [0m<inf> app_lwm2m_client: This may take several minutes.[0m
2023-04-17T10:52:00.799Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:06.542,358] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2[0m
2023-04-17T10:52:03.020Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:08.711,151] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1[0m
2023-04-17T10:52:03.024Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:08.712,036] [0m<inf> app_lwm2m_client: Connected to NB-IoT network[0m
2023-04-17T10:52:03.027Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:08.712,432] [1;31m<err> gnss_module: Failed to set GNSS use case (-13)[0m
2023-04-17T10:52:03.030Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:08.712,554] [0m<inf> app_lwm2m_client: Client connect to server[0m
2023-04-17T10:52:03.033Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:08.712,615] [0m<inf> 3: Start LWM2M Client: urn:*************[0m
2023-04-17T10:52:03.036Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:09.508,758] [0m<inf> 3: RD Client started with endpoint '********' with client lifetime 43200[0m
2023-04-17T10:52:05.311Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:11.032,226] [0m<inf> lwm2m_security: Need to write credentials, requesting LTE and GNSS offline...[0m
2023-04-17T10:52:05.316Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:11.573,089] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0[0m
2023-04-17T10:52:05.319Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:11.573,242] [0m<inf> app_lwm2m_client: LwM2M is connecting to server[0m
2023-04-17T10:52:06.424Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:12.168,334] [0m<inf> lwm2m_security: Requesting LTE and GNSS online[0m
2023-04-17T10:52:09.417Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:15.161,254] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2[0m
2023-04-17T10:52:10.843Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:16.567,321] [0m<inf> lwm2m_security: Modem connection restored[0m
2023-04-17T10:52:10.849Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:16.767,120] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1[0m
2023-04-17T10:52:10.866Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:16.767,425] [0m<inf> app_lwm2m_client: LwM2M is connecting to server[0m
2023-04-17T10:52:12.263Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:17.969,573] [0m<inf> net_lwm2m_engine: Connected, sock id 0[0m
2023-04-17T10:52:12.267Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:18.547,973] [0m<dbg> app_lwm2m_client: rd_client_event: Registration complete[0m
2023-04-17T10:52:12.270Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:18.548,034] [0m<inf> 3: Registration Done (EP='9CjKyTlser')[0m
2023-04-17T10:52:12.273Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:18.548,339] [0m<inf> app_lwm2m_client: LwM2M is connected to server[0m
2023-04-17T10:52:12.277Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:18.548,431] [0m<inf> app_lwm2m_client: Obtained date-time from modem[0m
2023-04-17T10:52:19.743Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:25.425,445] [0m<inf> download_client: Setting up TLS credentials, tag 16842753[0m
2023-04-17T10:52:19.748Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:25.425,567] [0m<inf> download_client: Connecting to https://download.*redacted*.com[0m
2023-04-17T10:52:19.751Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:25.682,983] [1;31m<err> download_client: Unable to connect, errno 116[0m
2023-04-17T10:52:19.754Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:25.683,380] [1;31m<err> lwm2m_firmware: fota_download_start() failed, return code -116[0m
2023-04-17T10:52:19.757Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:25.684,783] [1;33m<wrn> fota_download: fota_download_cancel invalid state[0m
2023-04-17T10:52:19.760Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:25.684,814] [1;31m<err> lwm2m_firmware: Unsupported Image type 0[0m
2023-04-17T10:52:19.763Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:25.684,814] [1;31m<err> lwm2m_firmware: Failed to reset DFU target, err: -13[0m
2023-04-17T10:52:49.241Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:54.987,121] [0m<dbg> app_lwm2m_client: rd_client_event: Queue mode RX window closed[0m

Parents Reply Children
  • Thank you !  WIll definitely try this.  Does the client distinguish when to use TLS and when not to strictly with http or https?  Or can it be configured later on?

    Kind regards

    Hassan

  • Hi again

    I have now gotten a certificate from the host server and uploaded to my device using LTE_link_monitor under the tag 16842753.  What else must I do?

    The error i'm getting now is as follows:

    2023-04-19T12:25:42.879Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:19.734,497] [0m<inf> app_lwm2m_client: Obtained date-time from modem[0m
    2023-04-19T12:26:27.599Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:01:03.895,904] [1;33m<wrn> download_client: No security tag provided for TLS/DTLS[0m
    2023-04-19T12:26:27.644Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:01:03.895,935] [1;31m<err> lwm2m_firmware: fota_download_start() failed, return code -22[0m
    2023-04-19T12:26:27.646Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:01:03.901,977] [1;33m<wrn> fota_download: fota_download_cancel invalid state[0m
    2023-04-19T12:26:27.648Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:01:03.902,008] [1;31m<err> lwm2m_firmware: Unsupported Image type 0[0m
    2023-04-19T12:26:27.650Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:01:03.902,008] [1;31m<err> lwm2m_firmware: Failed to reset DFU target, err: -13[0m

  • This is printed from here. It looks like the security tag hasn't been properly set. Have you checked why it hasn't been set? What is CONFIG_LWM2M_CLIENT_UTILS_DOWNLOADER_SEC_TAG set to in the .config file?

  •  Hi Hakon

    Yes it was correctly set and the default is also that tag.  

    I was experimenting and found that if I set 

    CONFIG_LWM2M_CLIENT_UTILS_DOWNLOADER_SEC_TAG=-1
    as well as use http and not https.  The result was this:
    2023-04-20T06:56:25.074Z DEBUG modem << [m[1;32muart:~$ [m[8D[J*** Booting Zephyr OS build v3.2.99-ncs2 ***
    2023-04-20T06:56:27.287Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.507,629] [0m<inf> app_lwm2m_client: Run LWM2M client[0m
    2023-04-20T06:56:27.289Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.507,629] [0m<inf> app_lwm2m_client: Initializing modem.[0m
    2023-04-20T06:56:27.291Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.509,857] [0m<inf> BH1749: BH1749 initialized[0m
    2023-04-20T06:56:27.292Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.524,627] [0m<inf> app_lwm2m_client: endpoint: urn:imei:351358811126421[0m
    2023-04-20T06:56:27.293Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:01.608,978] [0m<dbg> app_lwm2m: buzzer_intensity_cb: Intensity: 100[0m
    2023-04-20T06:56:27.294Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.610,382] [0m<inf> app_sensors: Finished accelerometer calibration[0m
    2023-04-20T06:56:27.295Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.610,687] [0m<dbg> app_sensors: colour_sensor_create: Created IPSO Colour Sensor instance: 0[0m
    2023-04-20T06:56:27.296Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.610,839] [0m<dbg> app_sensors: colour_sensor_create: Created IPSO Colour Sensor instance: 1[0m
    2023-04-20T06:56:27.297Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.610,961] [0m<inf> lwm2m_lte_notification: Registering ncell notification handler[0m
    2023-04-20T06:56:27.299Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.611,053] [0m<inf> lwm2m_firmware: Image is confirmed OK[0m
    2023-04-20T06:56:27.301Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.611,083] [0m<inf> app_lwm2m_client: Connecting to network.[0m
    2023-04-20T06:56:27.302Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:03.611,083] [0m<inf> app_lwm2m_client: This may take several minutes.[0m
    2023-04-20T06:56:30.565Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:06.995,544] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2[0m
    2023-04-20T06:56:32.662Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:09.037,414] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1[0m
    2023-04-20T06:56:32.664Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:09.038,269] [0m<inf> app_lwm2m_client: Connected to NB-IoT network[0m
    2023-04-20T06:56:32.666Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:09.038,665] [1;31m<err> gnss_module: Failed to set GNSS use case (-13)[0m
    2023-04-20T06:56:32.667Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:09.038,757] [0m<inf> app_lwm2m_client: Client connect to server[0m
    2023-04-20T06:56:32.668Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:09.039,764] [0m<inf> net_lwm2m_rd_client: Start LWM2M Client: urn:imei:351358811126421[0m
    2023-04-20T06:56:32.669Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:10.008,972] [0m<inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:351358811126421' with client lifetime 43200[0m
    2023-04-20T06:56:35.140Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:11.548,919] [0m<inf> lwm2m_security: Need to write credentials, requesting LTE and GNSS offline...[0m
    2023-04-20T06:56:35.142Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:12.026,336] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0[0m
    2023-04-20T06:56:35.143Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:12.026,489] [0m<inf> app_lwm2m_client: LwM2M is connecting to server[0m
    2023-04-20T06:56:37.631Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:14.063,537] [0m<inf> lwm2m_security: Requesting LTE and GNSS online[0m
    2023-04-20T06:56:40.463Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:16.894,561] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 2[0m
    2023-04-20T06:56:41.825Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:18.237,609] [0m<inf> lwm2m_security: Modem connection restored[0m
    2023-04-20T06:56:41.827Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:18.437,408] [0m<dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 1[0m
    2023-04-20T06:56:41.829Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:18.437,713] [0m<inf> app_lwm2m_client: LwM2M is connecting to server[0m
    2023-04-20T06:56:43.285Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:19.677,917] [0m<inf> net_lwm2m_engine: Connected, sock id 0[0m
    2023-04-20T06:56:43.287Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:20.279,296] [0m<dbg> app_lwm2m_client: rd_client_event: Registration complete[0m
    2023-04-20T06:56:43.289Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:20.279,357] [0m<inf> net_lwm2m_rd_client: Registration Done (EP='wCanStCGMV')[0m
    2023-04-20T06:56:43.292Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:20.279,663] [0m<inf> app_lwm2m_client: LwM2M is connected to server[0m
    2023-04-20T06:56:43.295Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:20.279,724] [0m<inf> app_lwm2m_client: Obtained date-time from modem[0m
    2023-04-20T06:57:19.748Z DEBUG modem << [1;32muart:~$ [m[8D[J[1;32muart:~$ [m[8D[J[00:00:56.184,112] [0m<inf> download_client: Connecting to http://download.quantapower.com[0m
    2023-04-20T06:57:19.857Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:56.380,645] [1;31m<err> download_client: Unable to connect, errno 116[0m
    2023-04-20T06:57:19.859Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:56.381,011] [1;31m<err> lwm2m_firmware: fota_download_start() failed, return code -116[0m
    2023-04-20T06:57:19.861Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:56.389,221] [1;33m<wrn> fota_download: fota_download_cancel invalid state[0m
    2023-04-20T06:57:19.864Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:56.389,221] [1;31m<err> lwm2m_firmware: Unsupported Image type 0[0m
    2023-04-20T06:57:19.865Z DEBUG modem << [1;32muart:~$ [m[8D[J[00:00:56.389,251] [1;31m<err> lwm2m_firmware: Failed to reset DFU target, err: -13[0m
    Following on from the last conversation, the tag is being correctly set(it is the same as the default):
    I think that that the problem is in the connection.  Do you perhaps have any hosts I could test my update on?  I would like to see whether my host is blocking the transfer.
    Thank you in advance!
    kind regards,
    Hassan
  • HI again

    Just found this post online. Is this still relevant? This is the exact error I having.  Also has the problem been resolved.

     FOTA update for multiple things on AWS got errno 116 

    Kind regards,

    Hassan

Related