Hello
I am using a custom board, based on nRF9160. I'm using SDK 2.7.0 and modem firmware 1.3.6.
After a bug in production where a device stopped sending data, I tracked down the issue to this function nrf_cloud_coap_connect().
In my specific case, after 55 successful calls, the function ends up returning -12 (ENOMEM 12 /* Not enough space */).
Any call after that returns the same error.
I guess the number of call depends on the firmware. Compiler states that my project uses ~33% of the available RAM, or 70kB.
The issue was seen a few times in production (deplyed devices) and I managed to reproduce with the following piece of code :
// General init
// Connect to LTE-M network
for(i=0;i<100;i++)
{
DEBUG_PRINT("Attempt %d\r\n", i);
// Ensure there is no remaining stuff opened
nrf_cloud_coap_disconnect() ;
// Create new connexion
err = nrf_cloud_coap_connect(NULL) ;
}This not due a network issue, as coverage is good in my office, and the issue is fully repeatable.
In step by step debug, the error pops up in nrf_cloud_coap_transport.c
At line 319, nrf_cloud_coap_connect() calls nrf_cloud_coap_transport_authenticate(), which errors (-1) at line 805.
Is this a known issue ? How can I solve this ?
I was expecting that calling nrf_cloud_coap_disconnect() was enough to close any opened thread/variable/wathever, but it seems something is eating the memory at every iteration.
Thanks