cancel
Showing results for 
Search instead for 
Did you mean: 

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

OCatt.1
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

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.

View solution in original post

6 REPLIES 6
Remi QUINTIN
ST Employee

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.

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.

Please note I am using a Windows App running on a Laptop containing a Bluetooth 5.1 chip.

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.

So shall I understand your issue is solved?

Hi Remi,

The Issue of setting 2M PHY Mode was resolved by looping through the above code, yes.

I am however looking for advice on two things further.

  1. Why was the above solution able to trigger 2M PHY mode?
  2. How am I able to maximise throughput of data transfer? (Setting in MX/parameters to change/look for in code).

I am currently only able to get about 5.8k/bps, (381k file in 66 seconds) when in 2M PHY Mode, however when testing in 1M PHY Mode I am able to get about 7kbps?

Is there a reason for this? Are there limitations when using Windows BLE? How can I resolve these issues and maximise my throughput for maximum transfer speed?

Thank you for the help.