CC2640R2 BLE5 Long Range mode

来源:互联网 发布:手机淘宝店铺怎么激活 编辑:程序博客网 时间:2024/06/05 12:46

How do I evaluate Long Range mode?

In addition to the High Speed 2 Mbps mode supported in the BLE5-Stack v1.0 protocol stack, TI has also enabled the ability to evaluate the LE Coded PHYs which are used to enable longer range Bluetooth connections at the same transmit power. The longer range is enabled by using Forward Error Correction (FEC) to improve receiver sensitivity. If you want to know more about the science behind coded PHYs and how they improve link budget without increasing transmit power, check out our blog How does Bluetooth® 5 increase the achievable range of a Bluetooth low energy connection? which includes a video demonstration of a 1.6 km BLE Long Range connection between CC2640R2 LaunchPads.

To enable the evaluation of the LE Coded PHYs in the SDK, enable the feature in the protocol stack’s build_config.opt file. Connections are established at the default 1 Mbps link speed (same as Bluetooth 4.x) and then can be switched to a LE Coded PHY via the PHY Update Procedure. Use of the LE Coded PHYs is also demonstrated in the Throughput Demo on GitHub. Evaluating the LE Coded PHYs will help you to measure actual performance your device will expect to achieve in the long range configuration.

Please note that you cannot certify your device with Bluetooth SIG when using the LE Coded PHY evaluation configuration from this SDK. TI intends to provides updates to the BLE5-Stack at a later time which will include additional features, such as Advertising Extensions, required to support a Bluetooth 5 LE Coded PHY certification.

实际操作一下:

请看下面的HCI_LE_EVENT_CODE,我们需要使用的HCI_PHY_OPT_S8即,选择使用coding n=8, 125kbps,同时设置发射功率5DBM:

  HCI_EXT_SetTxPowerCmd(HCI_EXT_TX_POWER_5_DBM);  HCI_EXT_SetRxGainCmd(HCI_EXT_RX_GAIN_HIGH);

static uint8_t SimpleBLEPeripheral_processStackMsg(ICall_Hdr *pMsg){  uint8_t safeToDealloc = TRUE;  switch (pMsg->event)  {    case GATT_MSG_EVENT:      // Process GATT message      safeToDealloc = SimpleBLEPeripheral_processGATTMsg((gattMsgEvent_t *)pMsg);      break;    case HCI_GAP_EVENT_EVENT:      {        // Process HCI message        switch(pMsg->status)        {          case HCI_COMMAND_COMPLETE_EVENT_CODE:            // Process HCI Command Complete Event            break;          case HCI_BLE_HARDWARE_ERROR_EVENT_CODE:            AssertHandler(HAL_ASSERT_CAUSE_HARDWARE_ERROR,0);            break;          case HCI_LE_EVENT_CODE:            {              hciEvt_BLEPhyUpdateComplete_t *pPUC                = (hciEvt_BLEPhyUpdateComplete_t*) pMsg;              if (pPUC->BLEEventCode == HCI_BLE_PHY_UPDATE_COMPLETE_EVENT)              {                if (pPUC->status != SUCCESS)                {                  Display_print0(dispHandle, SBP_ROW_STATUS_1, 0, "PHY Change failure");                }                else                {                  Display_print0(dispHandle, SBP_ROW_STATUS_1, 0, "PHY Update Complete");                  uint8_t index = 0;                  switch(pPUC->rxPhy)                  {                    case HCI_PHY_1_MBPS:                      index = 0;                      break;                    case HCI_PHY_2_MBPS:                      index = 1;                      break;                    case HCI_PHY_CODED:                      {                        if(phyOptions == HCI_PHY_OPT_S2)                          index = 2;                        else if (phyOptions == HCI_PHY_OPT_S8)                          index = 3;                        Util_startClock(&periodicLED);                      }                      break;                  }                  Display_print1(dispHandle, SBP_ROW_STATUS_3, 0, "Current PHY: %s",                                 phyName[index]);                }              }              if (pPUC->BLEEventCode == HCI_BLE_DATA_LENGTH_CHANGE_EVENT)              {                // TX PDU Size Updated                hciEvt_BLEDataLengthChange_t *dleEvt = (hciEvt_BLEDataLengthChange_t *)pMsg;                Display_print1(dispHandle, SBP_ROW_STATUS_2, 0, "PDU Size: %dB", dleEvt->maxTxOctets);              }            }            break;          default:            break;        }      }      break;    default:      // do nothing      break;  }  return (safeToDealloc);}

第二种方式:

使用SmartRF Studio 7: