Application gets stack when checking for shadow register or FOTA using CoAP protocol, at network loss

Hello

I am developing an application on the nRF9160 SiP, that using CoAP protocol (over LTE) it connects to the nRF Cloud to transmit sensor data, get shadow register configuration and perform a FOTA. The application is build on nRF Connect SDK v2.6.1.

The main operation is as follows:
wake up periodically -> check for an available FOTA -> check for the shadow register and update the local configuration -> read the sensor data -> report the data to the nRF Cloud -> go to low power mode

All the above operations have been tested and are working with no problems, except in a rare case, at some point I noticed that the application gets stack and does not respond to any other event. (I am using the application event manager to handle the operation) The application never returns to its normal operation.

By looking at the problem I noticed that it gets stack when checking for FOTA or when checking for the shadow register. I also noticed that if I remove the LTE antenna from my board at the point that checking for FOTA or for the shadow register the application gets stack every time. So, it looks like that the problem occurs when there is no communication with the server.

By looking at the nRF Cloud library functions I noticed that i both cases (checking for FOTA or shadow register) at some point the function nrf_cloud_coap_get(..) is called from the file nrf_cloud_coap_transport.c


At the nrf_cloud_coap_transport.h it has the following information about the nrf_cloud_coap_get(..) function:
/**@brief Perform CoAP GET request.
*
* The function will block until the response or an error have been returned.
*..

So, it looks like the problem might occur because the nrf_cloud_coap_get(..) is a blocking function, and in the case that there is no response from the server it stays forever inside this function.
Can you confirm that this might be the case? How can I workaround this problem in a case of network disconnection or no communication with the server?

Thank you

Parents Reply Children
No Data
Related