<?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>Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81951/revert-back-to-coded-phy-connection-when-2m-is-not-possible-because-of-distance</link><description>Hi, 
 I have 2 nrf52840 DK boards advertising on coded PHY mode. Once connected the connection is updated (using sd_ble_gap_phy_update()) to use 2M mode. No problem in doing so. 
 However, I have a situation or use case where after the successful update</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Dec 2021 11:25:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81951/revert-back-to-coded-phy-connection-when-2m-is-not-possible-because-of-distance" /><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/343609?ContentTypeID=1</link><pubDate>Wed, 15 Dec 2021 11:25:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:480701df-52f8-41b3-95ec-0cdf083ecc76</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;No, I don&amp;#39;t think the Coded PHY should have reduced range because you switch between 2MBPS and Coded PHY. You will need to make sure that the Coded PHY side have enough time to transmit its data between every time it switches between 2MBPS and Coded PHY, but as soon as it is in Coded PHY, it shouldn&amp;#39;t be hindered by its own radio.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/343518?ContentTypeID=1</link><pubDate>Wed, 15 Dec 2021 00:44:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f67e9fa2-aa8f-42ab-afc7-75bd3bc7a8df</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Thank you Simon, at least now we have more understanding why we don&amp;#39;t see the extended range possible with Coded PHY.&lt;br /&gt;&lt;br /&gt;One more thing, in our setup, we have this nRF52840 DK siting in between 2 other DKs communicating back and forth between them. This middle DK establishes 2M connection with one DK and Coded PHY with the other DK.&lt;br /&gt;&lt;br /&gt;Do you think as a result of this setup/configuration, we get reduced range as well with the Coded PHY link since the radio on the middle DK is shared/multiplexed between talking on 2M to one and Coded PHY to the other?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/343355?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 10:17:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba23204e-6903-4145-af26-fd486ca32d65</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry you have trouble with the DevZone. You can try deleting your browser cookies to see if that helps with the loading times of DevZone pages.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This other DK or 52 device (on top of the 840 DK) also doing BLE transmissions is indeed likely to affect the range you&amp;#39;ll be able to achieve over Coded PHY, as they transmit on similar frequencies they&amp;#39;re bound to affect each others performance I&amp;#39;m afraid. I don&amp;#39;t think the data length will affect your range, just the transmission time between each event, since Coded PHY transmissions take ~8 times longer than transmissions on the other PHYs.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/343055?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 07:33:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baeca26d-449e-45bf-b891-0fc36d58380a</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Hi Simon, Thanks for coming back.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the long silence. I&amp;#39;ve got some problem with this website. It takes forever to load this page and just realised I need to close my browser and reopen it for it to work for some strange reason.&lt;/p&gt;
&lt;p&gt;Will try to get some sniffer trace for you. Isn&amp;#39;t the code I shown at the top the advertising initialization?&lt;/p&gt;
&lt;p&gt;We went out to the open field and conducted the Nordic long range test below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/testing-long-range-coded-phy-with-nordic-solution-it-simply-works-922075585"&gt;https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/testing-long-range-coded-phy-with-nordic-solution-it-simply-works-922075585&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We managed to get CodedPHY adv at 475m, which is better than what we could with our firmware at 200m.&lt;/p&gt;
&lt;p&gt;One thing I forgot to mentioned is that in addition to the nRF52840 DK, we also have a nRF52DK board stacked on top of it&amp;nbsp;propagating Bluetooth 4.2 radio protocol. Will that affect/decrease the range of Coded PHY on the 52840 DK?&lt;/p&gt;
&lt;p&gt;Also comparing the bluetooth parameters we have with the Nordic long range example, we are using datalength of 251 and the example datalength is 27.&lt;br /&gt;Do you know if these bluetooth parameters have an effect on the range as well?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/342021?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 10:13:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9c27656-0fdf-49b6-9d06-d11460dcca71</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;A timeout would point to the connection not communicating for a while, either due to poor reception or just that the application doesn&amp;#39;t do anything. Since you&amp;#39;re using the Sniffer, I assume you can see there that the devices indeed are communicating over the Coded PHY before doing this sd_ble_gap_phy_update() but I really think you should be able to see successful transmissions on the Coded PHY for more than 200m. Can you show me your advertising initialization or upload your sniffer trace so I can take a look at it?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/341424?ContentTypeID=1</link><pubDate>Wed, 01 Dec 2021 02:06:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a023f3b6-5693-4943-babd-2b1bff7ace56</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/81951/revert-back-to-coded-phy-connection-when-2m-is-not-possible-because-of-distance/341255#341255"]Are you able to see the disconnect reason between the two devices when disconnecting in Coded PHY? [/quote]
&lt;p&gt;The reason is HCI status code is 0x08 Connection Timeout.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/81951/revert-back-to-coded-phy-connection-when-2m-is-not-possible-because-of-distance/341255#341255"]If you have a connection running on the Coded PHY I agree that you should be able to do a sd_ble_gap_phy_update(), but it might fail, or disconnect right away when the devices are too far apart to sustain a connection on the 2MBPS PHY.[/quote]
&lt;p&gt;Thanks for the confirmation, however I have yet to make the update fail / disconnect right away.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/341255?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 11:52:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1403d1f3-49a9-4edb-af1a-286ffd88d6ea</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I think the L2CAP fragment CRC errors indicate lower sensitivity and thus more packets failing to reach their destination correctly, but as long as you still get the data you&amp;#39;re transmitting as expected this shouldn&amp;#39;t be anything to worry about.&lt;/p&gt;
&lt;p&gt;When the devices are connected in Coded PHY I agree that you should be able to sustain a connection over more than 200 meters. Are you able to see the disconnect reason between the two devices when disconnecting in Coded PHY? I think we need to find the reason for the disconnect to determine why you&amp;#39;re not able to attain longer ranges with Coded PHY than 2MBPS PHY.&lt;/p&gt;
&lt;p&gt;If you have a connection running on the Coded PHY I agree that you should be able to do a sd_ble_gap_phy_update(), but it might fail, or disconnect right away when the devices are too far apart to sustain a connection on the 2MBPS PHY.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/341187?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 07:55:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af6c9203-5625-4cc3-aa31-0bfc8667ac72</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve setup the nRF Sniffer in the office and verified that we are advertising in coded PHY and then successfully updated the PHY mode to 2Mbps on connection. All subsequent transactions are in 2Mbps.&lt;/p&gt;
&lt;p&gt;I do noticed too as the distance increases while connected on 2M, I saw a lot more L2CAP Fragment with the CRC Error flag set. Does that mean something I need to take note of?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thereafter I went and do more range testing this time in an open area. Same setup as before, advertising in Coded PHY, on succesful connection update PHY to 2Mbps.&lt;/p&gt;
&lt;p&gt;Findings,&lt;/p&gt;
&lt;p&gt;I am able to connect on coded PHY and update to 2Mbps every single time up to a distance of around 200 metres. As I then walked further, the boards disconnected and I am not able to reconnect again until I walked back into range i.e. 200 metres.&lt;/p&gt;
&lt;p&gt;I then modified my code to only adv and connect on Coded PHY, NO UPDATE of PHY to 2 Mbps. I observed the same results as before! I thought I will be able to get couple of hundreds metres more than 2 Mbps but No.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Can you please help me with this last question. If we can connect on Coded PHY adv, we can always update to 2Mbps regardless of the distance (say 1 Km) since we both agree&amp;nbsp;sd_ble_gap_phy_update()&amp;nbsp;function takes place in the current PHY which is Coded yes? And if on successful update to 2Mbps (PHY PHY_UPDATE event trig), because the distance is now too great for 2Mbps to support, a disconnection will result instaneously? or will it not?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thanks Simon.&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340854?ContentTypeID=1</link><pubDate>Fri, 26 Nov 2021 09:23:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92ffb217-9163-4865-a6b0-21e13d1b91a0</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I think the easiest way to make sure what PHY is used is to either print in a log what PHY is currently used, or to use a sniffer device to catch the packets on the air and see what PHY it is sent over. I&amp;#39;m only aware of the &lt;a href="https://www.ellisys.com/products/btcompare.php"&gt;Ellisys sniffers&lt;/a&gt; that support sniffing over the Coded PHY, but you could use the &lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/intro.html"&gt;nRF Sniffer&lt;/a&gt; to detect any activity on the 2MBPS PHY at least. You can also choose the advertising device so you don&amp;#39;t catch a lot of random BLE activity as well.&lt;/p&gt;
&lt;p&gt;You can also&amp;nbsp;&lt;strong&gt;only&amp;nbsp;&lt;/strong&gt;use 2MBPS to connect and check what range you are able to achieve, as I don&amp;#39;t know&amp;nbsp;&lt;strong&gt;how&amp;nbsp;&lt;/strong&gt;noisy your test environment is. Even though I don&amp;#39;t think you&amp;#39;ll be able to reach 100m in a noisy environment even with 8dBm TX power.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340814?ContentTypeID=1</link><pubDate>Fri, 26 Nov 2021 01:43:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:745ad744-c24b-4cf1-82e9-09d19562e2be</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Thanks Simon,&lt;/p&gt;
&lt;p&gt;Will try to do some more testing with the distance as suggested.&lt;/p&gt;
&lt;p&gt;I am abit concern now if I did indeed connect on 2MBPS at 100 metres. Maybe it was still on Coded PHY!&lt;/p&gt;
&lt;p&gt;A side note, we have the Tx power set to 8dBm, a high one. Not sure if it says something.&lt;/p&gt;
&lt;p&gt;Just to confirm if the Central initiate the PHY update, do we have to confirm on BOTH the peripheral and central side that they both received the&amp;nbsp;&lt;span&gt;BLE_GAP_EVT_PHY_UPDATE event before we can be sure that the connection link is indeed updated to 2 MBPS?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Any other means to check for current PHY status?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Because currently, I only handle that event in the peripheral, not the central.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is it still possible that we connect on 2MBPS only to disconnect almost instantaneously because of poor reception or interference?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340686?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 10:10:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a73f7d83-d17a-488a-bdf2-80de58cc999f</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;100 meters in a noisy environment as you describe, does indeed sound like too far away for a 2MBPS PHY connection, I would think you need to get as close as 20 meters to get a good connection on the 2MBPS PHY. sd_ble_gap_phy_update() is used to initiate or respond to a PHY update procedure. It will always generate a BLE_GAP_EVT_PHY_UPDATE event if executed successfully. Yes, it will stay on the current PHY within this function, then generate a PHY_UPDATE event (if successful) which will cause the devices to move to the new PHY.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Initiate or respond to a PHY Update Procedure
 *
 * @details   This function is used to initiate or respond to a PHY Update Procedure. It will always
 *            generate a @ref BLE_GAP_EVT_PHY_UPDATE event if successfully executed.
 *            If this function is used to initiate a PHY Update procedure and the only option
 *            provided in @ref ble_gap_phys_t::tx_phys and @ref ble_gap_phys_t::rx_phys is the
 *            currently active PHYs in the respective directions, the SoftDevice will generate a
 *            @ref BLE_GAP_EVT_PHY_UPDATE with the current PHYs set and will not initiate the
 *            procedure in the Link Layer.
 *
 *            If @ref ble_gap_phys_t::tx_phys or @ref ble_gap_phys_t::rx_phys is @ref BLE_GAP_PHY_AUTO,
 *            then the stack will select PHYs based on the peer&amp;#39;s PHY preferences and the local link
 *            configuration. The PHY Update procedure will for this case result in a PHY combination
 *            that respects the time constraints configured with @ref sd_ble_cfg_set and the current
 *            link layer data length.
 *
 *            When acting as a central, the SoftDevice will select the fastest common PHY in each direction.
 *
 *            If the peer does not support the PHY Update Procedure, then the resulting
 *            @ref BLE_GAP_EVT_PHY_UPDATE event will have a status set to
 *            @ref BLE_HCI_UNSUPPORTED_REMOTE_FEATURE.
 *
 *            If the PHY procedure was rejected by the peer due to a procedure collision, the status
 *            will be @ref BLE_HCI_STATUS_CODE_LMP_ERROR_TRANSACTION_COLLISION or
 *            @ref BLE_HCI_DIFFERENT_TRANSACTION_COLLISION.
 *            If the peer responds to the PHY Update procedure with invalid parameters, the status
 *            will be @ref BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS.
 *            If the PHY procedure was rejected by the peer for a different reason, the status will
 *            contain the reason as specified by the peer.
 *
 * @events
 * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update Procedure.}
 * @endevents
 *
 * @mscs
 * @mmsc{@ref BLE_GAP_CENTRAL_PHY_UPDATE}
 * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_UPDATE}
 * @endmscs
 *
 * @param[in] conn_handle   Connection handle to indicate the connection for which the PHY Update is requested.
 * @param[in] p_gap_phys    Pointer to PHY structure.
 *
 * @retval ::NRF_SUCCESS Successfully requested a PHY Update.
 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
 * @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported PHYs supplied to the call.
 * @retval ::NRF_ERROR_INVALID_STATE No link has been established.
 * @retval ::NRF_ERROR_BUSY Procedure is already in progress or not allowed at this time. Process pending events and wait for the pending procedure to complete and retry.
 *
 */
SVCALL(SD_BLE_GAP_PHY_UPDATE, uint32_t, sd_ble_gap_phy_update(uint16_t conn_handle, ble_gap_phys_t const *p_gap_phys));&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
[quote user="JasonGeo"]always connect in Coded PHY and if RSSI value is strong (which means devices are close to each other) trigger a PHY update to switch to 2M[/quote]
&lt;p&gt;Yes, that should work as well.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340625?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 01:28:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a652ee36-74e9-4d0e-b697-b35d3a3217d4</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;The distance is approximately 100 metres. Note that this is conducted on a noisy street with buildings on either sides of the road. One of the board is laying flat on the walk steps hence the reception might not be that great.&lt;/p&gt;
&lt;p&gt;Yes, I saw from the logging that PHY is updated to 2MBPS.&lt;/p&gt;
&lt;p&gt;Thanks for the confirmation on the code.&lt;/p&gt;
[quote userid="111111" url="~/f/nordic-q-a/81951/revert-back-to-coded-phy-connection-when-2m-is-not-possible-because-of-distance/340445#340445"]Correct me if I am wrong, but I think the &amp;quot;handshake&amp;quot; between central and peripheral is still taking place on Coded PHY when sd_ble_gap_phy_update() is taking place and when they are both updated to 2M, because of the distance is too far for 2M to support, the devices would disconnect after a short interval, say between 1 to 5 seconds?&amp;nbsp;Shoudl this be the&amp;nbsp;expected observation?[/quote]
&lt;p&gt;Can you help to confirm if this is the case?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/81951/revert-back-to-coded-phy-connection-when-2m-is-not-possible-because-of-distance/340242#340242"]You can make the central device check the RSSI (Received Signal Strength Indicator) of the peripheral and when it&amp;#39;s under a certain value you can trig a PHY update to switch to the Coded PHY.[/quote]
&lt;p&gt;I think for my use case, it would be more of always connect in Coded PHY and if RSSI value is strong (which means devices are close to each other) trigger a PHY update to switch to 2M. Will that work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340547?ContentTypeID=1</link><pubDate>Wed, 24 Nov 2021 13:14:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:353b5c02-0e81-43b0-b829-5b27befe7dbe</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi again&lt;/p&gt;
&lt;p&gt;What is the distance you&amp;#39;re seeing between the two devices exactly? Are you able to see the MTU/PHY update in logging or something to make sure you actually move to the 2MBPS PHY? Your advertising parameters seem to be correct, so I would think it advertises on the Coded PHY at least.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340445?ContentTypeID=1</link><pubDate>Wed, 24 Nov 2021 03:22:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6855838c-88b7-4f14-bc0b-43257449f7eb</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thanks for coming back!&lt;/p&gt;
&lt;p&gt;The SDK version is nRF5_SDK_15.2.0&lt;/p&gt;
&lt;p&gt;Yes, one DK is acting as a central and the other is advertising and connecting to it.&lt;/p&gt;
&lt;p&gt;I am surprised too that I don&amp;#39;t get the extra range Coded PHY provides. As mentioned, whenever I got connected on Coded PHY mode, the central will ask for PHY mode change to 2M via&amp;nbsp;&lt;span&gt;sd_ble_gap_phy_update().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Correct me if I am wrong, but I think the &amp;quot;handshake&amp;quot; between central and peripheral is still taking place on Coded PHY when sd_ble_gap_phy_update() is taking place and when they are both updated to 2M, because of the distance is too far for 2M to support, the devices would disconnect after a short interval, say between 1 to 5 seconds?&amp;nbsp;Shoudl this be the&amp;nbsp;expected observation?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve inherited the code base from a contractor and is still understanding it. Advertising code is shown below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;CBleAdvertiser::CBleAdvertiser()
{
	memset(&amp;amp;m_AdvData, 0, sizeof(m_AdvData));
    memset(&amp;amp;m_AdvParams, 0, sizeof(m_AdvParams));

	m_AdvParams.p_peer_addr     = NULL;    // Undirected advertisement.
    m_AdvParams.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_AdvParams.duration        = 0;       // Never time out.
	m_AdvParams.primary_phy 	= BLE_GAP_PHY_1MBPS;
	m_AdvParams.secondary_phy 	= BLE_GAP_PHY_1MBPS;

    m_AdvData.name_type = BLE_ADVDATA_FULL_NAME;
    m_AdvData.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
}

void CBleAdvertiser::SetPhyMode(AdvMode_t _mode)
{
	m_AdvMode = _mode;
	switch (m_AdvMode) {
		case ADV_1MBPS:
			m_AdvParams.primary_phy 	= BLE_GAP_PHY_1MBPS;
			m_AdvParams.secondary_phy 	= BLE_GAP_PHY_1MBPS;
			break;
		case ADV_2MBPS:
			m_AdvParams.primary_phy 	= BLE_GAP_PHY_2MBPS;
			m_AdvParams.secondary_phy 	= BLE_GAP_PHY_2MBPS;
			break;
		case ADV_CODED:
			m_AdvParams.primary_phy 	= BLE_GAP_PHY_CODED;
			m_AdvParams.secondary_phy 	= BLE_GAP_PHY_CODED;
			break;
		default:
			m_AdvParams.primary_phy 	= BLE_GAP_PHY_1MBPS;
			m_AdvParams.secondary_phy 	= BLE_GAP_PHY_1MBPS;
			break;
	}

	if (m_AdvParams.properties.type == BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED
		|| m_AdvParams.properties.type == BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED)
	{  // Connectable
		EnableConnectableAdvertisement(true);
	}
	else
	{  // NonConnectable
		EnableConnectableAdvertisement(false);
	}
}

void CBleAdvertiser::EnableConnectableAdvertisement(bool _enable)
{
	if (m_AdvMode == ADV_CODED)
	{
		m_AdvParams.properties.type = _enable ? BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED : BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
	} 
	else 
	{
		m_AdvParams.properties.type = _enable ? BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED : BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
	}
}

void CBleAdvertiser::SetAdvertisementInterval(uint32_t _interval)
{
	m_AdvParams.interval = MSEC_TO_UNITS(_interval, UNIT_0_625_MS);
}

bool CBleAdvertiser::SetDeviceName(const char * _device_name)
{
	ble_gap_conn_sec_mode_t sec_mode;
	BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;sec_mode);
    	
	uint32_t err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode, (const uint8_t *)_device_name, strlen(_device_name));
	APP_ERROR_CHECK(err_code);
    
	return err_code == NRF_SUCCESS;
}

void CBleAdvertiser::SetCompanyId(uint16_t _company_id)
{
	m_ManufData.company_identifier = _company_id;	
}


CBleAdvertiser::Me().SetPhyMode(CBleAdvertiser::ADV_CODED);
CBleAdvertiser::Me().EnableConnectableAdvertisement(true);
CBleAdvertiser::Me().SetAdvertisementInterval(300);
CBleAdvertiser::Me().SetDeviceName(BLE_MESH_NODE_NAME);
CBleAdvertiser::Me().SetCompanyId(0xFFFE);



bool CBleAdvertiser::Configure()
{
	static uint8_t enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX];  // Buffer for storing an encoded advertising set.
	static ble_gap_adv_data_t adv_data =
	{
	    .adv_data =
	    {
	        .p_data = enc_advdata,
	        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
	    },
	    .scan_rsp_data =
	    {
	        .p_data = NULL,
	        .len    = 0
	    }
	};

    if(m_AdvParams.interval == 0)
	{
    	m_AdvParams.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS);
	}

	uint32_t err_code = ble_advdata_encode((const ble_advdata_t *)&amp;amp;m_AdvData, adv_data.adv_data.p_data, &amp;amp;adv_data.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_Handle, &amp;amp;adv_data, &amp;amp;m_AdvParams);

    if ((err_code != NRF_SUCCESS) &amp;amp;&amp;amp; (err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp; (err_code != BLE_ERROR_INVALID_ADV_HANDLE))
    {
        APP_ERROR_CHECK(err_code);
    }

    return true;
}

bool CBleAdvertiser::StartAdvertisement()
{
    ret_code_t err_code = sd_ble_gap_adv_start(m_Handle, APP_BLE_CONN_CFG_TAG);
    if(err_code != NRF_SUCCESS)
    {
    	LOG(&amp;quot;Error start adv %u&amp;quot;, err_code);
    }
	return ( err_code == NRF_SUCCESS );
}



void UpdateAdvPacket()
{
	CBleAdvertiser::Me().StopAdvertisement();
	CBleAdvertiser::Me().SetManufacturerData((const void *)&amp;amp;m_AdvManufactureData, sizeof(m_AdvManufactureData));
	CBleAdvertiser::Me().Configure();
	CBleAdvertiser::Me().SetTxPower(CBle::Txp8dBm);
	bool ret = CBleAdvertiser::Me().StartAdvertisement();
	ASSERT(ret);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the suggestions on triggering the PHY update. I wouldn&amp;#39;t have thought about them if you did not mention them!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/340242?ContentTypeID=1</link><pubDate>Tue, 23 Nov 2021 07:43:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c9a2e7b-a91d-4022-99f7-7bd5a864a635</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;What SDK version are you using here? I assume one of the nRF52840 DKs are acting as a central, and the other is advertising and connecting to it, correct? It sounds strange that you don&amp;#39;t see a range difference between when connected in Coded PHY and the 2MBPS PHY I must say. Can you show me how you set up Coded PHY advertising in your application?&lt;/p&gt;
&lt;p&gt;There is no &amp;quot;automatic&amp;quot; way to switch the PHY when the connection starts having issues, so you&amp;#39;ll have to find a way to do a MTU/PHY update at some point. Here are a few suggestions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can make the central device check the RSSI (Received Signal Strength Indicator) of the peripheral and when it&amp;#39;s under a certain value you can trig a PHY update to switch to the Coded PHY.&lt;/li&gt;
&lt;li&gt;If your central device starts losing packets from the peripheral and gets corrupt data, you can make that trig a PHY update to switch to the Coded PHY&lt;/li&gt;
&lt;li&gt;Upon a disconnection caused by HCI_CONNECTION_TIMEOUT for example (indicating that the connection timed out due to poor reception or no activity) you can trig a reconnect that sets the connection to Coded PHY.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I don&amp;#39;t think there are any error codes caused by a device being out of range, as it would give the same behavior as a device with poor reception or a lot of interference.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Revert back to Coded PHY connection when 2M is not possible because of distance.</title><link>https://devzone.nordicsemi.com/thread/339965?ContentTypeID=1</link><pubDate>Mon, 22 Nov 2021 08:41:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa25fab0-e99b-44de-9b14-0331019749b5</guid><dc:creator>JasonGeo</dc:creator><description>&lt;p&gt;Also is there a disconnected reason status code (HCI_STATUS_CODE) associated with distance being out of range?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>