DLE is supported by both the Apollo3Blue family and the Apollo4Blue family. It is enabled by default in AmbiqSuite. If the remote device supports DLE as well, the negotiation is triggered automatically after connection. Once the negotiation is done between the two connected devices, the application firmware receives the event of DM_CONN_DATA_LEN_CHANGE_IND indicating the data length has been updated.
Add the following code snippet to the message handler of the application, take the example ble_freertos_fit from AmbiqSuite, to check the applied data length.
<ambiqsuite_root>/third_party/cordio/ble-profiles/sources/apps/fit/fit_main.c:static void fitProcMsg(fitMsg_t *pMsg)
uiEvent = APP_UI_CONN_CLOSE;
break;
+ case DM_CONN_DATA_LEN_CHANGE_IND:
+ APP_TRACE_INFO2("DM_CONN_DATA_LEN_CHANGE_IND, Tx=%d, Rx=%d", ((hciLeDataLenChangeEvt_t*)pMsg)->maxTxOctets, ((hciLeDataLenChangeEvt_t*)pMsg)->maxRxOctets);
+ break;
To know if the remote device also supports DLE, check the following SWO logging from the following code snippet.
<ambiqsuite_root>/third_party/cordio/ble-profiles/sources/apps/app/app_slave.c:
case DM_REMOTE_FEATURES_IND:
{
hciEvt_t *pEvent = (hciEvt_t *)pMsg;
uint8_t data_len_ext = pEvent->leReadRemoteFeatCmpl.features[0]&HCI_LE_SUP_FEAT_DATA_LEN_EXT;
APP_TRACE_INFO2("remote feature: 0x%x, DLE:0x%x", pEvent->leReadRemoteFeatCmpl.features[0],data_len_ext);
if(data_len_ext == HCI_LE_SUP_FEAT_DATA_LEN_EXT)
{
APP_TRACE_INFO0("Remote device support DLE");
DmConnSetDataLen(pMsg->hdr.param, LE_MAX_TX_SIZE, LE_MAX_TX_TIME);
}
else
{
APP_TRACE_INFO0("Remote device doesn't support DLE");
}
Comments
0 comments
Please sign in to leave a comment.