You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/02/15 10:01:14 UTC

[GitHub] andrzej-kaczmarek closed pull request #811: nimble: Enable 2M PHY on nRF52

andrzej-kaczmarek closed pull request #811: nimble: Enable 2M PHY on nRF52
URL: https://github.com/apache/mynewt-core/pull/811
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/drivers/nimble/nrf52/src/ble_phy.c b/hw/drivers/nimble/nrf52/src/ble_phy.c
index 17020bf62..adae7f054 100644
--- a/hw/drivers/nimble/nrf52/src/ble_phy.c
+++ b/hw/drivers/nimble/nrf52/src/ble_phy.c
@@ -275,12 +275,14 @@ ble_phy_mode_set(int cur_phy_mode, int txtorx_phy_mode)
     } else if (cur_phy_mode == BLE_PHY_MODE_2M) {
         NRF_RADIO->MODE = RADIO_MODE_MODE_Ble_2Mbit;
         NRF_RADIO->PCNF0 = NRF_PCNF0_2M;
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
     } else if (cur_phy_mode == BLE_PHY_MODE_CODED_125KBPS) {
         NRF_RADIO->MODE = RADIO_MODE_MODE_Ble_LR125Kbit;
         NRF_RADIO->PCNF0 = NRF_PCNF0_CODED;
     } else if (cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
         NRF_RADIO->MODE = RADIO_MODE_MODE_Ble_LR500Kbit;
         NRF_RADIO->PCNF0 = NRF_PCNF0_CODED;
+#endif
     } else {
         assert(0);
     }
@@ -578,10 +580,12 @@ ble_phy_get_ccm_datarate(void)
         return CCM_MODE_DATARATE_1Mbit << CCM_MODE_DATARATE_Pos;
     case BLE_PHY_MODE_2M:
         return CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos;
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
     case BLE_PHY_MODE_CODED_125KBPS:
         return CCM_MODE_DATARATE_125Kbps << CCM_MODE_DATARATE_Pos;
     case BLE_PHY_MODE_CODED_500KBPS:
         return CCM_MODE_DATARATE_500Kbps << CCM_MODE_DATARATE_Pos;
+#endif
     }
 
     assert(0);
@@ -780,7 +784,7 @@ ble_phy_get_cur_rx_phy_mode(void)
 
     phy = g_ble_phy_data.phy_cur_phy_mode;
 
-#if BLE_LL_BT5_PHY_SUPPORTED
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
     /*
      * For Coded PHY mode can be set to either codings since actual coding is
      * set in packet header. However, here we need actual coding of received
@@ -789,12 +793,7 @@ ble_phy_get_cur_rx_phy_mode(void)
      */
     if ((phy == BLE_PHY_MODE_CODED_125KBPS) ||
                                     (phy == BLE_PHY_MODE_CODED_500KBPS)) {
-        /*
-         * XXX CI field value is bits [2:1] in NRF_RADIO->PDUSTAT which is
-         *     available in nrfx for nrf52840 only - it's NRF_RADIO->RESERVED7[0]
-         *     for other nrf52 vairants.
-         */
-        phy = NRF_RADIO->PDUSTAT & 0x06 ?
+        phy = NRF_RADIO->PDUSTAT & RADIO_PDUSTAT_CISTAT_Msk ?
                                    BLE_PHY_MODE_CODED_500KBPS :
                                    BLE_PHY_MODE_CODED_125KBPS;
     }
diff --git a/net/nimble/controller/include/controller/ble_phy.h b/net/nimble/controller/include/controller/ble_phy.h
index c7d1d61fd..d6fdcea93 100644
--- a/net/nimble/controller/include/controller/ble_phy.h
+++ b/net/nimble/controller/include/controller/ble_phy.h
@@ -26,8 +26,8 @@
 extern "C" {
 #endif
 
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY) && !MYNEWT_VAL(BSP_NRF52840)
-#error LE 2M PHY can only be enabled on nRF52840
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY) && !(MYNEWT_VAL(BSP_NRF52) || MYNEWT_VAL(BSP_NRF52840))
+#error LE 2M PHY can only be enabled on nRF52xxx
 #endif
 
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY) && !MYNEWT_VAL(BSP_NRF52840)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services