<?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>Wifi timeout with periodic reconnection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108270/wifi-timeout-with-periodic-reconnection</link><description>Hello, I want to connect to a server through Wifi periodicaly, every n time I do the following steps: 1) Bring the interface up with `net_if_up(iface)` 2) Ask the wifi for a connection with `net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &amp;amp;connection_parameters</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Feb 2024 12:29:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108270/wifi-timeout-with-periodic-reconnection" /><item><title>RE: Wifi timeout with periodic reconnection</title><link>https://devzone.nordicsemi.com/thread/469791?ContentTypeID=1</link><pubDate>Tue, 20 Feb 2024 12:29:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0423f6b6-ee6a-4399-9b6e-81ec48877319</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the update. Let me know if you have an update and need more help!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wifi timeout with periodic reconnection</title><link>https://devzone.nordicsemi.com/thread/469623?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2024 16:58:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76fd0601-be95-47aa-b7ed-7d756d772193</guid><dc:creator>BENBF</dc:creator><description>&lt;div class="flex flex-grow flex-col max-w-full"&gt;
&lt;div data-message-author-role="assistant" data-message-id="bffb5aec-f330-4049-9a9d-0deaa55b19b8"&gt;
&lt;div class="markdown prose w-full break-words dark:prose-invert dark"&gt;
&lt;p&gt;Hello, sorry for the late response. After trying to isolate the bug from our codebase to provide you with more information, we noticed that the connection/reconnection issue was no longer present. We found that the issue was dependent on specific metrics, such as the type of Wi-Fi the card tries to connect to. This leaves us more opportunities to find the bug. We will look for it on our own for the moment, but we may reach out to you again later if we manage to isolate the bug with more accuracy. Thank you for your time and have a great day.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wifi timeout with periodic reconnection</title><link>https://devzone.nordicsemi.com/thread/469046?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 14:09:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31f426cc-ef86-4f2f-a5b3-66e62c3d06bf</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Based on your logs it seems like you are getting a timeout when trying to connect to Wi-Fi, but I have not been able to figure out why yet.&lt;/p&gt;
&lt;p&gt;Can you share a minimal sample, or your project, where this issue can be reproduced so I can test it on my side? If you do not want to share it in a public ticket, please let me know and I can make it private first.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wifi timeout with periodic reconnection</title><link>https://devzone.nordicsemi.com/thread/468881?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 15:29:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5cf9eef-89b1-42c8-b7e6-8c85cdf4c2b5</guid><dc:creator>BENBF</dc:creator><description>&lt;p&gt;Hello, sorry for the delay. I had to do some tests to try and give you as much information as possible. One thing I might have forgotten to say is that the function call to connect to the Wi-Fi is made in another thread than the main thread. Here is how the thread is created:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define HC_WIFI_THREAD_STACK_SIZE 5000
#define HC_THREAD_PRIORITY 1

struct k_thread hc_wifi_thread_data;
K_THREAD_STACK_DEFINE(hc_wifi_thread_stack, HC_WIFI_THREAD_STACK_SIZE);
k_tid_t wifi_thread;

static void hc_wifi_thread_init(void)
{
    wifi_thread = k_thread_create(&amp;amp;hc_wifi_thread_data, hc_wifi_thread_stack,
                                 K_THREAD_STACK_SIZEOF(hc_wifi_thread_stack),
                                 hc_wifi_loop,
                                 NULL, NULL, NULL,
                                 HC_THREAD_PRIORITY, 0, K_NO_WAIT);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regarding the logs,&lt;/span&gt;&lt;span&gt; most of them are personal,&lt;/span&gt;&lt;span&gt; but here is the &lt;/span&gt;&lt;strong&gt;log&lt;/strong&gt;&lt;span&gt; of one of my tests of Wi-Fi connection and disconnection:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; I: wifi_nrf_wpa_supp_associate: Association request sent successfully
00&amp;gt; 
00&amp;gt; I: Received: 192.168.1.38
00&amp;gt; I: IPv4 address: 192.168.1.38
00&amp;gt; I: Lease time: 86400 seconds
00&amp;gt; I: Subnet: 255.255.255.0
00&amp;gt; I: Router: 192.168.1.1
00&amp;gt; &amp;lt;Inf&amp;gt; WiFi connected
00&amp;gt; Fetching SNTP time, trying servers...
00&amp;gt; &amp;lt;Inf&amp;gt; Timestamp received from server 0: 1707927033781
00&amp;gt; &amp;lt;Inf&amp;gt; Disconnection requested
00&amp;gt; &amp;lt;Inf&amp;gt; WiFi disconnected
00&amp;gt; W: iface 0x20001dc8 is down
00&amp;gt; W: iface 0x20001dc8 is down
00&amp;gt; Waiting for next move
00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; &amp;lt;Err&amp;gt; WiFi connection failed (-116)
00&amp;gt; &amp;lt;Wrn&amp;gt; Could not connect to the WiFi
00&amp;gt; Waiting for next move
00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; &amp;lt;Err&amp;gt; WiFi connection failed (-116)
00&amp;gt; &amp;lt;Wrn&amp;gt; Could not connect to the WiFi
00&amp;gt; Waiting for next move
00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; &amp;lt;Err&amp;gt; WiFi connection failed (-116)
00&amp;gt; &amp;lt;Wrn&amp;gt; Could not connect to the WiFi
00&amp;gt; Waiting for next move
00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; I: wifi_nrf_wpa_supp_associate: Association request sent successfully
00&amp;gt; 
00&amp;gt; I: Received: 192.168.1.38
00&amp;gt; I: IPv4 address: 192.168.1.38
00&amp;gt; I: Lease time: 86400 seconds
00&amp;gt; I: Subnet: 255.255.255.0
00&amp;gt; I: Router: 192.168.1.1
00&amp;gt; &amp;lt;Inf&amp;gt; WiFi connected
00&amp;gt; Fetching SNTP time, trying servers...
00&amp;gt; &amp;lt;Inf&amp;gt; Timestamp received from server 0: 1707927355024
00&amp;gt; &amp;lt;Inf&amp;gt; Disconnection requested
00&amp;gt; &amp;lt;Err&amp;gt; Disconnection request failed
00&amp;gt; &amp;lt;Wrn&amp;gt; Could not deconnect from the wifi
00&amp;gt; Waiting for next move
00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; &amp;lt;Err&amp;gt; WiFi connection failed (-116)
00&amp;gt; &amp;lt;Wrn&amp;gt; Could not connect to the WiFi
00&amp;gt; Waiting for next move
00&amp;gt; &amp;lt;Inf&amp;gt; Executing GET_NTP_TIME
00&amp;gt; &amp;lt;Inf&amp;gt; Connection requested
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; &amp;lt;Inf&amp;gt; WiFi disconnected
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; I: wifi_nrf_wpa_supp_associate: Association request sent successfully
00&amp;gt; 
00&amp;gt; I: Received: 192.168.1.38
00&amp;gt; I: IPv4 address: 192.168.1.38
00&amp;gt; I: Lease time: 86400 seconds
00&amp;gt; I: Subnet: 255.255.255.0
00&amp;gt; I: Router: 192.168.1.1
00&amp;gt; &amp;lt;Inf&amp;gt; WiFi connected
00&amp;gt; Fetching SNTP time, trying servers...
00&amp;gt; &amp;lt;Err&amp;gt; Couldn&amp;#39;t reach SNTP server 0
00&amp;gt; &amp;lt;Inf&amp;gt; Timestamp received from server 1: 1707927612285
00&amp;gt; &amp;lt;Inf&amp;gt; Disconnection requested
00&amp;gt; &amp;lt;Err&amp;gt; Disconnection request failed
00&amp;gt; &amp;lt;Wrn&amp;gt; Could not deconnect from the wifi
00&amp;gt; I: wifi_nrf_wpa_supp_authenticate:Authentication request sent successfully
00&amp;gt; 
00&amp;gt; &amp;lt;Inf&amp;gt; WiFi disconnected&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To provide you with the maximum amount of information, I&amp;#39;ve conducted some tests and included their results below. Each test followed these steps:&lt;/p&gt;
&lt;p&gt;Connect to the Wi-Fi network.&lt;br /&gt; Record the current time.&lt;br /&gt; Disconnect from the Wi-Fi network.&lt;br /&gt; Wait for n seconds.&lt;br /&gt; Repeat steps 1-4 seven times.&lt;/p&gt;
&lt;p&gt;(Note: &amp;quot;OK&amp;quot; indicates successful connection to the Wi-Fi, while &amp;quot;KO&amp;quot; indicates a connection timeout.)&lt;/p&gt;
&lt;p&gt;Test Results:&lt;/p&gt;
&lt;p&gt;n = 0 seconds: [OK, KO, KO, KO, KO, KO, KO]&lt;br /&gt; n = 30 seconds: [OK, KO, KO, KO, OK, KO, OK]&lt;br /&gt; n = 2 minutes: [OK, KO, KO, OK, KO, KO, KO]&lt;br /&gt; n = 5 minutes: [OK, KO, OK, KO, KO, KO, KO]&lt;/p&gt;
&lt;p&gt;I hope these tests provide you with more information about my issue. Please let me know if you need any further clarification.&lt;/p&gt;
&lt;p&gt;Thank you for your time and assistance. Have a great day!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wifi timeout with periodic reconnection</title><link>https://devzone.nordicsemi.com/thread/468828?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 13:31:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aaa2eed3-105f-4d76-88a6-33df4397c8c6</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Do you have any application logs you can share?&lt;/p&gt;
&lt;p&gt;How quickly do you try to reconnect again after disconnecting, and do you see a difference in behavior when you increase this time?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>