Skip to main content
OCatt.1
Associate III
September 20, 2021
Solved

Can Phy be set to 2M when connected to a Windows App?

  • September 20, 2021
  • 6 replies
  • 2501 views

Hello,

I was just wondering whether it was possible to form a 2M PHY connection with a Windows BLE App?

I have developed firmware for my STM32WB nucleo board, along with a C#.NET Windows application to connect with it.

I am trying to maximise throughput for file transfer however using the "hci_le_set_phy" and "hci_le_read_phy" functions to attempt to set and read the PHY of the connections shows that despite trying to set the PHY to 2M, it remains at 1M.

Is this a limitation with the board, the fact the app is running on Windows (can't change phy from app side), or some other factor which I'm not seeing?

Any information would be much appreciated!

Oliver.

This topic has been closed for replies.
Best answer by Remi QUINTIN

The 2MB PHY mode can only be negotiated in between 2 devices once they are connected. Then both devices must support this feature with an appropriate PHY capability.

WB support the 2M PHY mode using HCI_LE_SET_DEFAULT_PHY or HCI_LE_SET_PHY with parameter value set to 0x02.

6 replies

Remi QUINTIN
Remi QUINTINBest answer
ST Technical Moderator
September 21, 2021

The 2MB PHY mode can only be negotiated in between 2 devices once they are connected. Then both devices must support this feature with an appropriate PHY capability.

WB support the 2M PHY mode using HCI_LE_SET_DEFAULT_PHY or HCI_LE_SET_PHY with parameter value set to 0x02.

OCatt.1
OCatt.1Author
Associate III
October 5, 2021

Hi Remi,

Thank you so much for the response. I am attempting to use those functions in order to set my PHY to 2M mode however I'm not having any luck.

This is the code I'm attempting to use to change the PHY mode.

void BLE_SVC_GAP_Change_PHY(void)
{
 uint8_t TX_PHY, RX_PHY;
 tBleStatus ret = BLE_STATUS_INVALID_PARAMS;
 ret = hci_le_read_phy(BleApplicationContext.BleApplicationContext_legacy.connectionHandle,&TX_PHY,&RX_PHY);
 if (ret == BLE_STATUS_SUCCESS)
 {
 APP_DBG_MSG("READ PHY : ");
 APP_DBG_MSG("PHY Param TX= %d, RX= %d \n", TX_PHY, RX_PHY);
 if ((TX_PHY == TX_2M) && (RX_PHY == RX_2M))
 {
 APP_DBG_MSG("*A*TX= %d, **RX= %d \n", TX_PHY, RX_PHY);
 }
 else
 {
 ret = hci_le_set_default_phy(ALL_PHYS_PREFERENCE,TX_2M_PREFERRED,RX_2M_PREFERRED);
 ret = hci_le_set_phy(BleApplicationContext.BleApplicationContext_legacy.connectionHandle,ALL_PHYS_PREFERENCE,TX_2M_PREFERRED,RX_2M_PREFERRED,0);
 ret = hci_le_read_phy(BleApplicationContext.BleApplicationContext_legacy.connectionHandle,&TX_PHY,&RX_PHY);
 APP_DBG_MSG("*B*TX= %d, **RX= %d \n", TX_PHY, RX_PHY);
 
 }
 }
 else
 {
 APP_DBG_MSG("Read conf not succeess \n");
 }
 
 return;
}

From this, once a connection is formed I retrieve the following output.

[10:24:00.216] HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE for connection handle 0x802Interval : 30, Latency : 0
[10:24:00.246] **MTU_size = 257 
 
[10:24:00.246] READ PHY : PHY Param TX= 1, RX= 1 *B*TX= 1, **RX= 1 **MTU_size = 257 
 
[10:24:00.371] READ PHY : PHY Param TX= 1, RX= 1 *B*TX= 1, **RX= 1 

I am unable to understand why the PHY mode remains in 1M mode.

I am also attempting to maximise my throughput, sending simple text files (anywhere from 1k to 1M+ bytes) from a windows App to the board. I have read through plenty of documentation regarding maximising throughput, however any advice would be appreciated!

Regards,

Oliver.

OCatt.1
OCatt.1Author
Associate III
October 5, 2021

After deciding to loop through the previously shown code, I found that the PHY mode was being set after some period of time, though I am unsure why this did not occur previously etc.