This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: 关于LE Coded PHY的问题

Part Number: CC2642R
Other Parts Discussed in Thread: CC2640R2F

请问,使用simple_peripheral程序,在连接上central后,调用HCI_LE_SetPhyCmd(pPkt->connectionHandle, HCI_PHY_USE_PHY_PARAM, HCI_PHY_CODED, HCI_PHY_CODED, LL_PHY_OPT_S8);

如果SimplePeripheral_processStackMsg中收到HCI_BLE_PHY_UPDATE_COMPLETE_EVENT,且status是success, 是不是可以确定当前建立的连接已经成功设置为LE Coded PHY传输方式?

另外,对于同一块板子,使用LE Coded PHY其传输距离是否一定比LE 1M的传输距离更远呢?

  • 如果SimplePeripheral_processStackMsg中收到HCI_BLE_PHY_UPDATE_COMPLETE_EVENT,且status是success, 是不是可以确定当前建立的连接已经成功设置为LE Coded PHY传输方式?

    对的,在API中有说明的,我给您提供文档连接,您可以更好的确定。

    dev.ti.com/.../nodeContent

    另外,对于同一块板子,使用LE Coded PHY其传输距离是否一定比LE 1M的传输距离更远呢?

    关于这个问题,LE CODED PHY 理论上牺牲了传输速率来提高传输距离,它分为前导码的长度也会影响不同的传输速度以及传输距离。实际应用中确比LE 1M的距离更远一些,

    也是在相同的发射机功率以及相同的环境下。

  • 通过进一步打印调试,我发现HCI_LE_SetPhyCmd(pPkt->connectionHandle, HCI_PHY_USE_PHY_PARAM, HCI_PHY_CODED, HCI_PHY_CODED, LL_PHY_OPT_S8)虽然返回成功,但在SimplePeripheral_processStackMsg的HCI_BLE_PHY_UPDATE_COMPLETE_EVENT回调中打印PHY的值,发现其值为3,即HCI_PHY_1_MBPS|HCI_PHY_2_MBPS,并未设置成Coded PHY.

    我又用BTool + HostTest程序+simple_peripheral程序测试,结果如下:

    --------------------------------------------------------------------
    [46] : <Tx> - 10:33:16.449
    -Type : 0x01 (Command)
    -OpCode : 0x2032 (HCI_LE_SetPhy)
    -Data Length : 0x07 (7) byte(s)
    Handle : 0x0000 (0)
    AllPhys : 0x00 (0) (Use Tx and Rx Phy Parameters)
    TxPhy : 0x04 (4) (
    Coded_Phy)
    RxPhy : 0x04 (4) (
    Coded_Phy)
    PhyOptions : 0x0002 (2) (Preferred S8 Coding on Tx)
    Dump(Tx):
    0000:01 32 20 07 00 00 00 04 04 02 00 .2 ........
    --------------------------------------------------------------------
    [47] : <Rx> - 10:33:16.483
    -Type : 0x04 (Event)
    -EventCode : 0x000F (HCI_CommandStatusEvent)
    -Data Length : 0x04 (4) bytes(s)
    Status : 0x00 (0) (SUCCESS)
    Num HCI Cmds : 0x01 (1)
    OpCode : 0x2032 (HCI_LE_SetPhy)
    Dump(Rx):
    0000:04 0F 04 00 01 32 20 .....2
    --------------------------------------------------------------------
    [48] : <Rx> - 10:33:25.404
    -Type : 0x04 (Event)
    -EventCode : 0x003E (HCI_LE_GenericReportEvent)
    -Data Length : 0x06 (6) bytes(s)
    LE Event Code : 0x0C (12) (HCI_LE_PhyUpdateCompleteEvent)
    LE Event Code : 0x0C (12) (HCI_LE_PhyUpdateCompleteEvent)
    Status : 0x00 (0) (SUCCESS)
    Handle : 0x0000 (0)
    TxPhy : 0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)
    RxPhy : 0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)
    Dump(Rx):
    0000:04 3E 06 0C 00 00 00 03 03 .>.......
    --------------------------------------------------------------------

    也是无法设置成Coded PHY. 现在项目(基于simple_peripheral)想使用Coded PHY, 请问怎样才可以设置成Coded PHY?

  • LE的PHY是蓝牙联盟规定的低功耗蓝牙的功能。有1M PHY、2M PHY和CODED PHY。需要进行配置才会开启使用。

    具体您可以参考:Developing a Bluetooth Low Energy Application » LE 2M PHYDeveloping a Bluetooth Low Energy Application » LE Coded PHY

  • 您好,文档中没有说怎么配置才会开启Coded PHY。只是说,HCI_LE_SetPhyCmd 可以设置PHY。

    我现在在central和peripheral的初始化中,都设置了:

    HCI_LE_SetDefaultPhyCmd(LL_PHY_USE_ANY_PHY, LL_PHY_1_MBPS | LL_PHY_2_MBPS| HCI_PHY_CODED, LL_PHY_1_MBPS | LL_PHY_2_MBPS| HCI_PHY_CODED);

    然后在连接建立后,设置Coded PHY:

    HCI_LE_SetPhyCmd(pPkt->connectionHandle, HCI_PHY_USE_PHY_PARAM, HCI_PHY_CODED, HCI_PHY_CODED, LL_PHY_OPT_S8);

    虽然返回成功,但在SimplePeripheral_processStackMsg的HCI_BLE_PHY_UPDATE_COMPLETE_EVENT回调中打印PHY的值,发现其值为3,即HCI_PHY_1_MBPS|HCI_PHY_2_MBPS,并未设置成Coded PHY.

  • 在Task3中有提到,您可以参考

  • 感谢您的耐心指导。我认真阅读了文档,也做了相关实验,发现PHY设成1M或者2M都是成功的,设成HCI_PHY_CODED则不成功,

    始终还是显示PHY被设成了3 (Phy_1_Mbps|Phy_2_Mbps)

    始终不明白问题出在哪里。

    难道是CC2642R1F不支持LE Coded PHY?

    亦或者要使用LE Coded PHY需要程序做特别的配置?但文档中都没有提到......

  • 以下是 BLE5-Stack 中当前的 PHY 限制:

    • BLE控制器不支持在每个方向(RX和TX)上使用不同PHY的非对称连接。

    • 对于CC2640R2F,不可能在LE 2M PHY上作为辅助PHY进行扫描。这在CC2640R2F BLE5堆栈的发行说明中被称为已知问题。

  • 1.我没有使用非对称连接,

    HCI_LE_SetPhyCmd(pPkt->connectionHandle, HCI_PHY_USE_PHY_PARAM, HCI_PHY_CODED, HCI_PHY_CODED, LL_PHY_OPT_S8)这不是非对称连接吧?

    2.我用的芯片是CC2642R1F

  • 根据你的描述,我认为问题可能在于你在连接建立后设置Coded PHY时使用了HCI_PHY_USE_PHY_PARAM参数。这个参数是用来告诉控制器使用指定的参数进行PHY更新,而不是使用默认的参数。因此,如果你没有设置相应的PHY参数,控制器会继续使用默认的参数,这可能导致你看到的现象。

  • HCI_LE_SetPhyCmd(pPkt->connectionHandle, HCI_PHY_USE_PHY_PARAM, HCI_PHY_CODED, HCI_PHY_CODED, LL_PHY_OPT_S8)这不是非对称连接吧?

    您这边发送端与接受端需要进行相同的配置

  • 我在central和peripheral的初始化中,都设置了:

    HCI_LE_SetDefaultPhyCmd(LL_PHY_USE_ANY_PHY, LL_PHY_1_MBPS | LL_PHY_2_MBPS| HCI_PHY_CODED, LL_PHY_1_MBPS | LL_PHY_2_MBPS| HCI_PHY_CODED);

  • 您好,我这边联系了其他的工程师,请耐心等待一下,正在跟进您这边的问题。

  • 我下载了最新的SDK SimpleLink CC13xx CC26xx SDK - 7.10.00.98,在例程simple_peripheral中,

    case HCI_LE_EVENT_CODE:中有以下代码:

    Display_printf(dispHandle, SP_ROW_STATUS_2, 0,
    "PHY Updated to %s",
    (pPUC->rxPhy == PHY_UPDATE_COMPLETE_EVENT_1M) ? "1M" :
    (pPUC->rxPhy == PHY_UPDATE_COMPLETE_EVENT_2M) ? "2M" :
    (pPUC->rxPhy == PHY_UPDATE_COMPLETE_EVENT_CODED) ? "CODED" : "Unexpected PHY Value");

    而宏定义在hci.h中,有:

    /**
    * @defgroup PHY_UPDATE PHY Update Complete Event
    * @{
    */
    #define PHY_UPDATE_COMPLETE_EVENT_1M 1 //!< Complete event for 1 Mbps
    #define PHY_UPDATE_COMPLETE_EVENT_2M 2 //!< Complete event for 2 Mbps
    #define PHY_UPDATE_COMPLETE_EVENT_CODED 3 //!< Complete event for coded phy

    根据这段代码的意思,设置Coded_phy如果结果返回3,意味着成功了。

    然而矛盾的是,使用BTool + HostTest程序+simple_peripheral程序测试,3在btool中并不是coded phy,而是

    0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)

    [1] : <Tx> - 07:37:52.328
    -Type : 0x01 (Command)
    -OpCode : 0x2032 (HCI_LE_SetPhy)
    -Data Length : 0x07 (7) byte(s)
    Handle : 0x0000 (0)
    AllPhys : 0x00 (0) (Use Tx and Rx Phy Parameters)
    TxPhy : 0x04 (4) (
    Coded_Phy)
    RxPhy : 0x04 (4) (
    Coded_Phy)
    PhyOptions : 0x0001 (1) (Preferred S2 Coding on Tx)
    Dump(Tx):
    0000:01 32 20 07 00 00 00 04 04 01 00 .2 ........
    --------------------------------------------------------------------
    [2] : <Rx> - 07:37:52.357
    -Type : 0x04 (Event)
    -EventCode : 0x000F (HCI_CommandStatusEvent)
    -Data Length : 0x04 (4) bytes(s)
    Status : 0x00 (0) (SUCCESS)
    Num HCI Cmds : 0x01 (1)
    OpCode : 0x2032 (HCI_LE_SetPhy)
    Dump(Rx):
    0000:04 0F 04 00 01 32 20 .....2
    --------------------------------------------------------------------
    [3] : <Rx> - 07:37:52.367
    -Type : 0x04 (Event)
    -EventCode : 0x003E (HCI_LE_GenericReportEvent)
    -Data Length : 0x06 (6) bytes(s)
    LE Event Code : 0x0C (12) (HCI_LE_PhyUpdateCompleteEvent)
    LE Event Code : 0x0C (12) (HCI_LE_PhyUpdateCompleteEvent)
    Status : 0x00 (0) (SUCCESS)
    Handle : 0x0000 (0)
    TxPhy : 0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)
    RxPhy : 0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)
    Dump(Rx):
    0000:04 3E 06 0C 00 00 00 03 03 .>.......
    --------------------------------------------------------------------
    [4] : <Tx> - 07:38:03.426
    -Type : 0x01 (Command)
    -OpCode : 0x2030 (HCI_LE_ReadPhy)
    -Data Length : 0x02 (2) byte(s)
    Handle : 0x0000 (0)
    Dump(Tx):
    0000:01 30 20 02 00 00 .0 ...
    --------------------------------------------------------------------
    [5] : <Rx> - 07:38:03.453
    -Type : 0x04 (Event)
    -EventCode : 0x000E (HCI_CommandCompleteEvent)
    -Data Length : 0x08 (8) bytes(s)
    Packets : 0x01 (1)
    OpCode : 0x2030 (HCI_LE_ReadPhy)
    Status : 0x00 (0) (SUCCESS)
    Handle : 0x0000 (0)
    TxPhy : 0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)
    RxPhy : 0x03 (3) (
    Phy_1_Mbps
    Phy_2_Mbps)
    Dump(Rx):
    0000:04 0E 08 01 30 20 00 00 00 03 03 ....0 .....
    --------------------------------------------------------------------

    那么我该相信哪个呢?

  • 正如实验室中提到的那样,

    “如果支持多个PHY,控制器将选择数据吞吐量最高的PHY。因此,如果有多个支持的PHY,则不会选择LE编码PHY。”

    作为参考,我建议你下面的帖子有完全相同的问题,它很详细,希望它能对你有很大帮助。

    e2e.ti.com/.../cc2642r-can-t-change-phy-to-coded

  • 非常感激您提供的这个帖子,里面有明确的答案。返回3说明设置Coded phy是成功的。

    Apparently, there is no problem to shift to the coded PHY. However, it seems to have a problem with the interpretation of the value returned by the BLE stack. The error is probably due to the differences between the HCI_LE_Set_PHY command and the LE PHY Update Complete event.

    According to the BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 2, Part E, §7.8.49 relative to the LE Set PHY command, the TX_PHYS and the RX_PHYS parameters are two bit masks of the authorized PHYs. To activate only the coded PHYs, these parameters has to be set to 0x04 (i.e. only the bit 2 has to be set). For 1M only, TX_PHYS and RX_PHYS has to be set to 0x01, and for 2M only to 0x02. Here the value passed can be ORed (i.e. you can authorize 1M and Coded PHY by setting TX_PHYS/RX_PHYS to 0x05).

    According to the BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 2, Part E, §7.7.65.12 relative to LE PHY Update Complete event,
    the parameters TX_PHY and RX_PHY are supposed to be set to 0x03 when the connection uses a Coded PHY. The other possible values are 0x01 (PHY 1M) and 0x02 (PHY 2M). The BLE spec does not allow ORed values here. Note: an ORed value would not have any sense as only one PHY is used at the time (the controller always selects the faster PHY available, so if both devices allow 1M and 2M, 2M will be used and the value returned will be 0x02).

  • 不客气,欢迎到论坛随时交流,很高兴能够帮助到您,谢谢