<?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>Controlling advertising timing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85897/controlling-advertising-timing</link><description>Using nRF5 SDK v16.0.0 on nRF5232. IDE = SES 
 When advertising is started, I want to advertise initially for 30 seconds, so I set APP_ADV_DURATION to 3000, and the device will advertise for 30 seconds. I only allow 1 connection, so when a device connects</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Mar 2022 14:00:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85897/controlling-advertising-timing" /><item><title>RE: Controlling advertising timing</title><link>https://devzone.nordicsemi.com/thread/358684?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2022 14:00:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6087b651-6102-442c-8037-bf4b51608404</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;For your first &amp;quot;preliminary&amp;quot; question. The advertising timeout will reset whenever it stops advertising, so that shouldn&amp;#39;t be what stops the advertising when you&amp;#39;re waiting for the &amp;quot;remaining advertising&amp;quot; timer, this must be something else stopping your advertisement. Does the device perhaps connect to a central again? Option 2 should be basically what the SoftDevice handler does when &amp;quot;restarting&amp;quot; advertising.&lt;/p&gt;
&lt;p&gt;I think something like what you explain here should be fine. Perhaps if you before restarting advertisements, you calculate the remaining advertising time, and set this to the &amp;quot;new&amp;quot; &lt;span&gt;APP_ADV_DURATION, so it advertises for the remaining amount of time. Then after it times out, you can set the&amp;nbsp;APP_ADV_DURATION back to 30 seconds.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>