<?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>[nRF52833] Retrieve Advertising RPA Address during a Connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94478/nrf52833-retrieve-advertising-rpa-address-during-a-connection</link><description>Hi, 
 I&amp;#39;m working on a legacy program (Peripheral) using nRF52833 and nRF5 SDK using SoftDevice S113. 
 In my application, when a connection is established I need to know the Resolvable address that was active when the Central connected to my peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Dec 2022 19:39:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94478/nrf52833-retrieve-advertising-rpa-address-during-a-connection" /><item><title>RE: [nRF52833] Retrieve Advertising RPA Address during a Connection</title><link>https://devzone.nordicsemi.com/thread/398833?ContentTypeID=1</link><pubDate>Fri, 02 Dec 2022 19:39:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f9ed4cb-33a9-48e4-9955-3940dd62e669</guid><dc:creator>Marco R</dc:creator><description>&lt;p&gt;Thank you so much Vidar for the quick reply and also for providing the code snippet. I just tested it and it works great, thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52833] Retrieve Advertising RPA Address during a Connection</title><link>https://devzone.nordicsemi.com/thread/398806?ContentTypeID=1</link><pubDate>Fri, 02 Dec 2022 15:30:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d15e99f9-0cd3-4c1e-9828-7be4c91fc27c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Marco,&lt;/p&gt;
&lt;p&gt;The Softdevice does not include an event to signal the application when the address has been updated, unfortunately. However, as you may know, the RPA is also rotated when you start advertising. This can be utilized to enable the application control when the address is rotated instead of having the Softdevice perform it in the background.&lt;/p&gt;
&lt;p&gt;I discussed this case with the Softdevice team, and they suggested that you configured the advertiser with a 30 second timeout and to extend the .private_addr_cycle_s interval (i.e. set adv. timeout &amp;gt; .private_addr_cycle_s )&amp;nbsp; to ensure the address is only cycled when advertising is re-started. Then when you get the&amp;nbsp;BLE_GAP_EVT_ADV_SET_TERMINATED after 30 seconds, you call adv. start again to restart the advertiser with a new RPA.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        /* Event reported by the adv. module when the Softdevice has raised the 
         * BLE_GAP_EVT_ADV_SET_TERMINATED event with reason BLE_GAP_EVT_ADV_SET_TERMINATED_REASON_TIMEOUT
         */
        case BLE_ADV_EVT_IDLE:
        {
            ble_gap_addr_t addr;
            
            /* Re-start advertising with a new RPA */
            err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
            APP_ERROR_CHECK(err_code);

            err_code = sd_ble_gap_adv_addr_get(0, &amp;amp;addr);
            APP_ERROR_CHECK(err_code);
            
            /* Current RPA */
            NRF_LOG_INFO(&amp;quot;RPA %02x:%02x:%02x:%02x:%02x:%02x&amp;quot;,
                          addr.addr[5],
                          addr.addr[4],
                          addr.addr[3],
                          addr.addr[2],
                          addr.addr[1],
                          addr.addr[0]
                          );
        }  break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>