<?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>About scan timeout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85058/about-scan-timeout</link><description>Hi, 
 I am using SDK 17.1.0 as a host scanner. When I changed the timeout to 0, there was a problem with the connection slave (NRF_ERROR_INVALID_PARAM). I&amp;#39;m pretty sure the problem is not caused by other conditions. Because other parameters remain the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Feb 2022 15:51:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85058/about-scan-timeout" /><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354664?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 15:51:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d571ef5-cca0-4823-a21e-1db2d58c425c</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;okay, thank you. I&amp;#39;ll mend the basics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354662?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 15:47:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:081df114-6929-4be7-bd3b-e2bc97d96f1c</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Looking more into this I found this post, giving some context to how the supervision timeout is intended to be used:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/10636/what-are-latency-and-supervision-timeout-limits"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/10636/what-are-latency-and-supervision-timeout-limits&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;With this in mind, I believe your best option might be to set a high value for the supervision timeout and restart the scan when it times out.&lt;/p&gt;
&lt;p&gt;My understanding is that the supervision timeout is how long you will allow to keep a connection while no packets have been sent, so it makes sense if this value is not allowed to be 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354641?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 14:56:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95961f29-37c0-47b7-baba-dd34f0a25864</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;The following are all parameters related to the scanning part:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_BLE_SCAN_SCAN_INTERVAL 160

#define NRF_BLE_SCAN_SCAN_DURATION 0

#define NRF_BLE_SCAN_SCAN_WINDOW 80

#define NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL 7.5

#define NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL 30

#define NRF_BLE_SCAN_SLAVE_LATENCY 0

#define NRF_BLE_SCAN_SUPERVISION_TIMEOUT 4000 // 0

#define NRF_BLE_SCAN_SCAN_PHY 1&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If the timeout parameter is set to 0, will other parameters conflict? Or is the connection error because the slave does not accept this value?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354627?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 14:36:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c9aaae3-5c11-4c4d-acc6-fdd0aaa1abdc</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;I haven&amp;#39;t confirmed it, but in my own program, other conditions remain unchanged. Changing the value of the timeout parameter to 0 will cause this error code.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand this very much, so I did it again in the official sample code uart_c.&lt;/p&gt;
&lt;p&gt;The results obtained are still as above.&lt;/p&gt;
&lt;p&gt;Incidentally, some scanning and filtering conditions are added, which can be connected normally. Until the timeout parameter is changed to 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354582?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 13:06:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a4dc7bb-0763-4e6a-917b-7df4717dd547</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;So it looks like&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html?cp=4_7_4_2_2_1_3_14#gacca0e56084c7b3ed832b1bfa3911b7fe"&gt;sd_ble_ gap_connect()&lt;/a&gt;&amp;nbsp;is complaining about something in your &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/structble__gap__scan__params__t.html?cp=4_7_4_2_2_1_6_10"&gt;ble_gap_scan_params_t struct&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I assume what you are trying to do is set the&amp;nbsp;&lt;span&gt;ble_gap_scan_params_t::timeout value to zero?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;According to &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_p___s_c_a_n___t_i_m_e_o_u_t.html?cp=4_7_4_2_2_1_1_20"&gt;the documentation&lt;/a&gt; it seems like setting it to zero should be equivalent to an unlimited timeout, so I&amp;#39;m not sure why this would cause an error.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Have you tried printing the contents of the scan params struct to check if it looks like you&amp;#39;d expect?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354527?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 10:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60a7b107-5b06-4ff6-bf8f-880a01731b1a</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;sd_ble_gap_connect();&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;return error code&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_PARAM&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354525?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 10:21:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:475a4d51-f90c-423d-8376-e19a0cb5309e</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;It&amp;#39;s possible that&amp;nbsp;&lt;span&gt;NRF_BLE_SCAN_SUPERVISION_TIMEOUT is not allowed to be 0, and this could be causing your error.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you know exactly what function in your code is returning the error code?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-Einar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354498?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 09:25:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fa244cd-ee01-4a9d-83cc-04548a9f17f9</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;Thank you for your prompt reply.&lt;/p&gt;
&lt;p&gt;I treat &lt;span&gt;NRF_BLE_SCAN_SUPERVISION_TIMEOUT&amp;nbsp;&lt;/span&gt;as a timeout parameter.&lt;/p&gt;
&lt;p&gt;I set this parameter to 0, and then a connection error occurred. The error code is&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_PARAM.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I don&amp;#39;t understand the meaning of this parameter and why it can&amp;#39;t be set to 0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The premise is that other scanning parameters remain the default (the routine used is uart_c)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354497?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 09:18:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a3458b4-66d1-4251-b711-63e8cb8e38b0</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;According to the documentation, NRF_BLE_SCAN_SCAN_DURATION can be set to 0x0000 to continue indefinitely:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fgroup__nrf__ble__scan__config.html&amp;amp;cp=8_1_6_2_15_0_9&amp;amp;anchor=gacdb9b51bb850e2dcb8b07baa78d45402"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fgroup__nrf__ble__scan__config.html&amp;amp;cp=8_1_6_2_15_0_9&amp;amp;anchor=gacdb9b51bb850e2dcb8b07baa78d45402&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But have you made sure all your scanning parameters are compatible with each other?&lt;/p&gt;
&lt;p&gt;You might have to change some of the other default parameters before you can remove the scan timeout.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About scan timeout</title><link>https://devzone.nordicsemi.com/thread/354455?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 03:37:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:541d4ad5-02ec-4225-9ced-fb4cdc5a668d</guid><dc:creator>June6</dc:creator><description>&lt;p&gt;&lt;span&gt;Oh! I see.&amp;nbsp;The scan timeout parameter is NRF_ BLE_ SCAN_ SCAN_ DURATION.&amp;nbsp;Not&amp;nbsp;NRF_BLE_SCAN_SUPERVISION_TIMEOUT.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div class="trans-right"&gt;
&lt;div class="output-wrap"&gt;
&lt;div class="output-mod ordinary-wrap"&gt;
&lt;div class="output-bd" dir="ltr"&gt;
&lt;p class="ordinary-output target-output clearfix"&gt;&lt;span class=""&gt;But why is it wrong to change this parameter from 4000 to 0?&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>