2021-09-20 02:35 AM
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.
Solved! Go to Solution.
2021-09-21 09:26 AM
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.
2021-09-21 09:26 AM
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.
2021-10-05 02:39 AM
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.
2021-10-05 03:06 AM
Please note I am using a Windows App running on a Laptop containing a Bluetooth 5.1 chip.
2021-10-05 05:17 AM
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.
2021-10-05 05:53 AM
So shall I understand your issue is solved?
2021-10-05 05:57 AM
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.
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.