<?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>BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89591/ble-coded-phy-how-to-determine-used-data-rate</link><description>Hello, 
 I&amp;#39;m trying to determine the actual used data rate for the coded PHY but cannot find the corresponding API / data structure / enums. 
 Am I missing something? Can someone give me a pointer? 
 Regards 
 Hardy</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 Jul 2022 07:52:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89591/ble-coded-phy-how-to-determine-used-data-rate" /><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/376342?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 07:52:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bef1202-4b65-49ee-8dcd-b2c5702650af</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Vidar has started his vacation. I don&amp;#39;t see any specific question here, more of a discussion&amp;nbsp;and&amp;nbsp;you are free to implement this as you best see fit based on your requirements. Just a quick note that even&amp;nbsp;&lt;span&gt;sd_ble_gap_connect() will wait for advertisement to be received before&amp;nbsp;the softdevice&amp;nbsp;will send the connection request packet, I believe that when you call&amp;nbsp;sd_ble_gap_connect() you can also specify which phy to use both for scanning when trying to establish connection and for the connection to be established based on the connection request packet. My general feel on coded phy is that it works reliably well outdoor, but indoor (especially in environment with other 2.4GHz interference) the throughput will be very much influenced by the fact that the risk of interference during packet transmission/reception is 8x that of standard 1Mbps phy.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/376007?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2022 12:22:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb8ef095-77dc-4ff1-808f-609c76afed1d</guid><dc:creator>rgrr2</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;apologies... I would like to reply to your latest post, but unfortunately this is not possible because there is no button to do it.&lt;/p&gt;
&lt;p&gt;Anyway: I understood, that on the central side one has to get an advertisement to know the PHY used by the peripheral.&lt;/p&gt;
&lt;p&gt;But what if the connection has been created via sd_ble_gap_connect() with a known peripheral so that no advertisements had to be received ahead?&lt;/p&gt;
&lt;p&gt;To answer your question: changing the connection interval is a matter of power/speed optimization. Our peripheral tries to send as many packets per event as the central is accepting.&amp;nbsp; Sometimes the behavior of the central (esp Androids) is not very consistent and we try to offer the central several connection parameters until both sides are happy.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Hardy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375977?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2022 09:59:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cee3468-340b-4324-a9e9-31a656c8bca8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Hardy,&lt;/p&gt;
&lt;p&gt;I agree with your summary of the peripheral role. Except it&amp;#39;s still not clear to me why you need to change the connection interval for the long range mode. You are not guaranteed 6 packets per connection event even if the interval is long enough. Does it have something to do with how you handle the transfer in your application maybe?&lt;/p&gt;
[quote user="Hardy"]advertisement packets are coming in, but it is not clear (to me), which PHYs the peer is supporting[/quote]
&lt;p&gt;You can read the this from the ble_gap_evt_adv_report_t struct included with the BLE_GAP_EVT_ADV_REPORT event.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375782?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 12:17:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cc063c0-6ee8-4403-9918-a73ea67aa956</guid><dc:creator>rgrr2</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;sorry... I guess I mixed up several things. I also meant the central in this case.&lt;/p&gt;
&lt;p&gt;For the peripheral the procedure is to my understanding as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;primary_phy in adv is just used to distribute some data via advertisements&lt;/li&gt;
&lt;li&gt;secondary_phy is used to connect (if extended advertising is used)&lt;/li&gt;
&lt;li&gt;so it is clear with which PHY the connection is being established&lt;/li&gt;
&lt;li&gt;after that, PHY can be changed via&amp;nbsp;sd_ble_gap_phy_update()&lt;/li&gt;
&lt;li&gt;the peer side application is informed about the PHY update request via the event&amp;nbsp;BLE_GAP_EVT_PHY_UPDATE_REQUEST and&amp;nbsp;BLE_GAP_EVT_PHY_UPDATE&lt;/li&gt;
&lt;li&gt;at the moment only S=8 is supported for PHY_CODED, so a PHY_CODED connection has always 125kbit/s&lt;/li&gt;
&lt;li&gt;with this information, the connection can be further optimized, e.g. setting connection period, packets/event etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So no problem here.&lt;/p&gt;
&lt;p&gt;But for the central:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;in the scan_params scan_phys is the bitmap which I mixed up in the post before&lt;/li&gt;
&lt;li&gt;in scan_phys one can set e.g. 1MBit and Coded&lt;/li&gt;
&lt;li&gt;advertisement packets are coming in, but it is not clear (to me), which PHYs the peer is supporting&lt;/li&gt;
&lt;li&gt;call to sd_ble_gap_connect() has to specify all PHYs selected in scan_phys above to get a connection&lt;/li&gt;
&lt;li&gt;the central does not really know about the PHY being used.&amp;nbsp; Right?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For your understanding: there is already a working application which uses 1MBit and we are currently discussing how to introduce PHY_CODED etc.&lt;/p&gt;
&lt;p&gt;Thanks for your support &amp;amp; regards&lt;/p&gt;
&lt;p&gt;Hardy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375744?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 11:03:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c97b1dd3-108d-4658-8007-e5c387a857d6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Hardy,&lt;/p&gt;
&lt;p&gt;Do you have an existing application that switches between multiple PHYs? You can&amp;#39;t specify multiple secondary PHYs for a single adv. set nor does the softdevice support configuration of multiple sets.&lt;/p&gt;
&lt;p&gt;I would recommend you try the &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE"&gt;nRF Sniffer for Bluetooth LE&lt;/a&gt; if you want to check what happens on-air.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375723?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 10:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb693bf1-ff07-4cde-b8ff-010e1e172ab7</guid><dc:creator>rgrr2</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;as far as I understood, one can specify multiply PHYs for the secondary.&amp;nbsp; So used PHY is not clear.&lt;br /&gt;&lt;br /&gt;Number of packets is a connection optimization which I would like to set to 6 (central supports this) if 1MBps PHY is used and to two if PHY_CODED is used.&lt;/p&gt;
&lt;p&gt;Also the connection interval has to be set accordingly, especially if you have power constraints, so that a maximum of 10ms radio time is allowed in a certain interval.&lt;/p&gt;
&lt;p&gt;So... how to determine used PHY?&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; kind regards&lt;/p&gt;
&lt;p&gt;Hardy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375712?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 09:31:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:992cb2e0-3bc1-43bc-aa0a-8f7ccd277c98</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Hardy,&lt;/p&gt;
&lt;p&gt;The connection is always established with the same PHY depending on how the advertiser is configured. The initiator will use your secondary_phy to initiate the connection if you do extended advertising. The primary phy is used otherwise.&lt;/p&gt;
[quote user="Hardy"]Problem here are the connection parameters, the device offers the central which could lead to impossible combinations.&amp;nbsp; E.g. 6 packets/event on a 12ms connection interval if PHY_CODED has been selected.[/quote]
&lt;p&gt;Do you want to have a longer interval if coded PHY is used? Please note that the number of packets you can send per connection event (i.e. even length) is not a connection paramter like the interval is. The number of packets you can send depends on what the central support, max. event length on the peripheral, and packet loss (event will end early if there is packet loss).&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375684?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 08:20:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ec88c92-41ab-460e-9d47-4348a9e9b055</guid><dc:creator>rgrr2</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;concerning the used PHY: if one offers a PHY via primary/secondary_phy in the adv params one does not automatically know which PHY is being used, right?&lt;/p&gt;
&lt;p&gt;Problem here are the connection parameters, the device offers the central which could lead to impossible combinations.&amp;nbsp; E.g. 6 packets/event on a 12ms connection interval if PHY_CODED has been selected.&lt;/p&gt;
&lt;p&gt;How to &amp;quot;code&amp;quot; around?&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Hardy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375500?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 09:32:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17b2cec6-9034-4457-b9d5-08d44ba7c192</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Hardy,&lt;/p&gt;
&lt;p&gt;I guess you could say s=2 support was introduced in this release since it did add support for receiving packets with this encoding. There is no Softdevice API to query what PHY is currently in use, but this should be easy to monitor from the app. The connection will always be established with the same PHY used by the advertiser, and the PHY can&amp;#39;t be updated without triggering the BLE_GAP_PHY_UPDATE event (&lt;span&gt;&lt;a title="PHY Update Procedure" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___b_l_e___g_a_p___e_v_t___p_h_y___m_s_c.html?cp=4_7_4_1_2_1_5_7"&gt;PHY Update Procedure&lt;/a&gt;&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375485?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 09:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f1c1d3c-f0c7-4df2-8b5f-ea0fb165ad77</guid><dc:creator>rgrr2</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;thanks for response.&amp;nbsp; I thought S=2 has been introduced in S140 6.0.0?&amp;nbsp; So I guess I&amp;#39;m wrong.&lt;/p&gt;
&lt;p&gt;One more point: how to determine, if PHY_CODED is really used?&amp;nbsp; Is there an API for querying the used PHY?&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; regards&lt;/p&gt;
&lt;p&gt;Hardy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Coded PHY: how to determine used data rate</title><link>https://devzone.nordicsemi.com/thread/375458?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 07:44:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46737f09-9b1e-4b26-bfb9-c5f75ecd6a60</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Hardy,&lt;/p&gt;
&lt;p&gt;As you have noticed, there event struct does not include any fields which tell what the actual data rate is. The Softdevice doesn&amp;#39;t support sending with s=2 encoding (500 kbit/s) so it&amp;#39;s only when you receive data that it may see this data rate. It is s=8 (125 kbit/s) otherwise.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>