<?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>Need to switch BLE off and on</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43202/need-to-switch-ble-off-and-on</link><description>I am developing based on ble_app_uart example of SDK12 for nRF51 DK and I need to switch BLE off completely when power disappears to save battery and switch back on when power is restored. How can I proceed? 
 In detail, I need answers to the following</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Feb 2019 07:58:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43202/need-to-switch-ble-off-and-on" /><item><title>RE: Need to switch BLE off and on</title><link>https://devzone.nordicsemi.com/thread/168985?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 07:58:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aec0886b-b629-4bc7-a1b1-51aa5d43449b</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Understood. Let me know if you run in to any issues with the API mentioned below.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to switch BLE off and on</title><link>https://devzone.nordicsemi.com/thread/168939?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2019 18:00:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ce577d2-6f77-47d5-b80c-666b76bf900b</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;Thanks Bjorn.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll try the BLE power on and off tomorrow and let you know here the result.&lt;/p&gt;
&lt;p&gt;Usually I use a HW detector (my board will be supplied with AC voltage) so I detect mains failure within 20 ms. The advantage is I can stop the peripherals and controller while voltage is still OK, guaranteeing that the controller always starts when power gets back.I know that controllers have Brown Out Reset detectors but even those sometimes hang the controller when voltage oscillates around the detection point.&lt;/p&gt;
&lt;p&gt;Anyway, I&amp;#39;ll give it a try at a later stage.&lt;/p&gt;
&lt;p&gt;Thanks for the tips.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to switch BLE off and on</title><link>https://devzone.nordicsemi.com/thread/168898?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2019 14:26:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:299dc956-8857-48a1-8641-4c479ee8365f</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Sergio,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is the NRF51 powered by both battery and a power supply? If so how are you switching between battery and power supply?&lt;/p&gt;
&lt;p&gt;The nRF51 has a Power Failure Comparator that can configured to generate an event when the supply voltage drops below a certain threshold, see the POFCON register in the nRF51 Reference Manual. You could also use the Low Power Comparator for this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q1: You can check the connection handle,&amp;nbsp;m_conn_handle. It is non-zero if you have a connection and is set to&amp;nbsp;BLE_CONN_HANDLE_INVALID = 0xFFFF if no connection is active. To disconnect you call&amp;nbsp;sd_ble_gap_disconnect() with the connection handle and a&amp;nbsp;hci_status_code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q2: Call&amp;nbsp;sd_ble_gap_adv_stop() to stop advertising. The Radio will then be automatically switched off.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q3: Call&amp;nbsp;ble_advertising_start(BLE_ADV_MODE_FAST) to start advertising again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>