<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110139/sending-nrfcloud-coap-while-network-not-available</link><description>Hello, I use nRFCloud to send CoAP messages, and it&amp;#39;s working fine under normal conditions. I am now trying to simulate a network loss, while sending some data. To do that, I simply remove the antenna of my device when sending. Here is my test flow :</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 May 2024 08:20:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110139/sending-nrfcloud-coap-while-network-not-available" /><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/486585?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 08:20:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4940748d-8919-4434-b3c0-7c9b23845228</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Vincent44"]Do you have an approximate release date for v2.7.0? Are we talking days, week, months ?[/quote]
&lt;p&gt;~End of June timeframe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/486558?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 06:21:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bdb7f136-398e-4675-96d2-ec6fe56993bc</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Do you have an approximate release date for v2.7.0? Are we talking days, week, months ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/486509?ContentTypeID=1</link><pubDate>Wed, 29 May 2024 17:53:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9b529a3-4a3a-4f78-9315-e022643a2253</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I got some input from the developers on this issue. We are aware of the issue; we have many improvements about to merge to NCS to improve reliability, including the abililty to detect and recover from network outages. These improvments will be part of the upcoming NCS v2.7.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/485162?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 13:59:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6401ad4-bcf6-4c85-b8fc-2ef105a4af2a</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;So, I tried adding a timer in order to stop the process in case it is stuck.&lt;/p&gt;
&lt;p&gt;The idea is to be able to pause/stop the sending, resulting in nrf_cloud_coap_json_message_send() to return an error code.&lt;/p&gt;
&lt;p&gt;The code looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;struct k_timer preventBeingStuckTimer ;
void preventBeingStuck_TimerCallback( struct k_timer * a)
{	
	nrf_cloud_coap_pause() ;
	k_timer_stop(&amp;amp;preventBeingStuckTimer) ;
}


bool COAP_Send(char * msg, uint16_t msgLen)
{	
	bool success ;
	int err ;	

	k_timer_start(&amp;amp;preventBeingStuckTimer, Z_TIMEOUT_MS(5000), Z_FOREVER ) ;

	err = nrf_cloud_coap_json_message_send(msg) ;

	if(err == 0){
		success = true ;
	}
	else
	{
		// Negative values are device-side errors defined in errno.h.
		// Positive values are cloud-side errors (CoAP result codes) defined in zephyr/net/coap.h. 
		if(err &amp;lt; 0){
			DEBUG_PRINT(&amp;quot;Error while sending (Device err: %d) !\r\n&amp;quot;, err) ;
		}else{
			DEBUG_PRINT(&amp;quot;Error while sending (Cloud err: %d) !\r\n&amp;quot;, err) ;
		}
		success = false ;
	}

	k_timer_stop(&amp;amp;preventBeingStuckTimer) ;
	
	return success ;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The timer triggers, but the execution hangs at nrf_cloud_coap_pause().&lt;/p&gt;
&lt;p&gt;My guess is that the nrfcloud_coap operations can&amp;#39;t be pause in case it is currently trying to send/receive data.&lt;/p&gt;
&lt;p&gt;I also tried &lt;span class="w"&gt;&lt;/span&gt;&lt;span class="sig-name descname"&gt;&lt;span class="n"&gt;&lt;span class="pre"&gt;nrf_cloud_coap_disconnect&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="sig-paren"&gt;&lt;/span&gt;(), which I expected to be more brutal ... but I got the same results.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;During my test, I also had similar issue with nRFCloud FOTA functions. I am not 100% sure that it was the exact same issue, as I was not in debug mode, but I noticed some watchdog reboot while my device was checking for FOTA nrf_cloud_rest_fota_job_get() at location where network quality was low.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How can I do to abort the process once it has been started ?&lt;/p&gt;
&lt;p&gt;As an extra safety, I can check that the device is still connected to the network before sending data. However, this won&amp;#39;t cover all cases, as disconnect can occur anytime.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/478895?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2024 08:37:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ebeacd1-60c8-4cb6-8b5e-59d3bdaa43c3</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;This still requires having a timer/WDT to detect that nrf_cloud_coap_json_message_send() is stuck.&lt;/p&gt;
&lt;p&gt;I guess it also implies using different threads.&lt;/p&gt;
&lt;p&gt;Being able to hand a timeout as parameter to nrf_cloud_coap_json_message_send() would be a nive feature.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/478582?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 14:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bcca552-35f6-4dea-83b7-276e7eabb52d</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Vincent44"]Concerning the WDT, it might be due to the fact I used the WDT_OPT_PAUSE_IN_SLEEP option.When I remove it, the watchdog does indeed reboots the device when it&amp;#39;s hanging at nrf_cloud_coap_json_message_send() with no network.[/quote]
&lt;p&gt;Yes, that would explain it. Regarding abort the sending, then maybe you could try&amp;nbsp;&lt;span&gt;nrf_cloud_coap_pause().&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending nRFCloud CoAP while network not available</title><link>https://devzone.nordicsemi.com/thread/478214?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 08:02:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c3fd237-9955-449b-8e16-b0222aa67ab3</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Concerning the WDT, it might be due to the fact I used the WDT_OPT_PAUSE_IN_SLEEP option.When I remove it, the watchdog does indeed reboots the device when it&amp;#39;s hanging at nrf_cloud_coap_json_message_send() with no network.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>