- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Based on example CE222046, I'm trying to use BLE 2M PHY. SetPhy fails with 0x2A, which if I followed the documentation correctly means:
"2.42 DIFFERENT TRANSACTION COLLISION (0x2A)
The Different Transaction Collision error code indicates that an LMP transaction or LL Procedure was started that collides with an ongoing transaction."
The reality is that I want to always force 2M and never have a 1M connection. Ideally we'd advertise using 2M PHY. We do use Cy_BLE_SetDefaultPhy() in the handler for CY_BLE_EVT_STACK_ON.
The Cy_BLE_SetPhy() is called from inside the ble callback for CY_BLE_EVT_DATA_LENGTH_CHANGE, same as the example code. Here's the relevant code in my callback:
case CY_BLE_EVT_DATA_LENGTH_CHANGE: {
debug_string("data length change\r\n");
cy_stc_ble_data_length_change_event_param_t *param = (cy_stc_ble_data_length_change_event_param_t *)event_param;
debug_string("rx = ");
debug_int32(param->connMaxRxOctets);
debug_string(", tx = ");
debug_int32(param->connMaxTxOctets);
debug_string(" bytes\r\nrx = ");
debug_int32(param->connMaxRxTime);
debug_string(", tx = ");
debug_int32(param->connMaxTxTime);
debug_string("\r\n");
static cy_stc_ble_set_phy_info_t phyParam;
phyParam.bdHandle = key_info.SecKeyParam.bdHandle;
phyParam.allPhyMask = CY_BLE_PHY_NO_PREF_MASK_NONE; // Require our pref for both TX and RX.
phyParam.phyOption = 0;
phyParam.rxPhyMask = CY_BLE_PHY_MASK_LE_2M;
phyParam.txPhyMask = CY_BLE_PHY_MASK_LE_2M;
Cy_BLE_EnablePhyUpdateFeature();
cy_en_ble_api_result_t api_result = Cy_BLE_SetPhy(&phyParam);
if (api_result != CY_BLE_SUCCESS) {
debug_string("failed to set phy to 2m\r\n");
debug_int32(api_result);
debug_string("\r\n");
}
break;
}
case CY_BLE_EVT_SET_PHY_COMPLETE: {
debug_string("set phy complete\r\n");
cy_stc_ble_events_param_generic_t *param = (cy_stc_ble_events_param_generic_t *)event_param;
debug_string("status = ");
debug_int32(param->status);
debug_string("\r\n");
Cy_BLE_GetPhy(notify_packet.connHandle.bdHandle);
break;
}
case CY_BLE_EVT_PHY_UPDATE_COMPLETE: {
debug_string("phy update complete\r\n");
cy_stc_ble_events_param_generic_t *param = (cy_stc_ble_events_param_generic_t *)event_param;
cy_stc_ble_phy_param_t *phy_params = (cy_stc_ble_phy_param_t *)param->eventParams;
if (param->status == 0) {
debug_string("new phy: ");
debug_int8(phy_params->txPhyMask);
debug_int8(phy_params->rxPhyMask);
debug_string("\r\n");
} else {
debug_string("failed, status = ");
debug_int32(param->status);
debug_string("\r\n");
}
Cy_BLE_GetPhy(notify_packet.connHandle.bdHandle);
break;
}
case CY_BLE_EVT_GET_PHY_COMPLETE: {
debug_string("get phy complete\r\n");
cy_stc_ble_events_param_generic_t *param = (cy_stc_ble_events_param_generic_t *)event_param;
cy_stc_ble_phy_param_t *phy_params = (cy_stc_ble_phy_param_t *)param->eventParams;
debug_string("get phy: ");
debug_int8(phy_params->txPhyMask);
debug_int8(phy_params->rxPhyMask);
debug_string("\r\n");
break;
}
The output from those debugs:
set phy complete
status = 00000000
get phy complete
get phy: 0101
data length change
rx = 0000001B, tx = 000000FB bytes
rx = 00000148, tx = 00000848
set phy complete
status = 0000002A
get phy complete
get phy: 0101
data length change
rx = 0000001B, tx = 000000FB bytes
rx = 00000148, tx = 00000848
set phy complete
status = 00000000
get phy complete
get phy: 0101
phy update complete
failed, status = 00000023
get phy complete
get phy: 0101
Why does the first "set phy complete" come with a status of 0x2A? Why does the first phy update show a status of 0x23?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello NiLe_4796031 ,
Please check your application with the CE222046_Throughput_Measurement example project from the PSoC Creator and let me know your observations. If you are still facing the issue then please share your complete project.
Thanks,
P Yugandhar.