<?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>NRF52840 advertise start and stop manually in logic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94143/nrf52840-advertise-start-and-stop-manually-in-logic</link><description>Hi all, 
 I want to ON and OFF advertise manually 
 My code working steps 
 1) (APP_ADV_DURATION 3000 ) after this seconds over 
 2) It hits on_adv_evt() function in this function case :BLE_ADV_EVT_IDLE i use sd_ble_gap_adv_stop(m_advertising.adv_handle</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Nov 2022 13:32:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94143/nrf52840-advertise-start-and-stop-manually-in-logic" /><item><title>RE: NRF52840 advertise start and stop manually in logic</title><link>https://devzone.nordicsemi.com/thread/396936?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2022 13:32:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25c7fbd4-064b-43fa-b01e-010597d2edfe</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you want to due unlimited advertising duration, set&amp;nbsp;&lt;span&gt;APP_ADV_DURATION to 0&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And make sure you use&amp;nbsp;General Discoverable Mode. i.e. in&amp;nbsp;&lt;/span&gt;advertising_init() you have this:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;/pre&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;Then it will not time-out and stop.&lt;/div&gt;
&lt;div&gt;And if you want to stop it manually,&amp;nbsp; try using&amp;nbsp;sd_ble_gap_adv_stop()&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>