This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129XNCZAD: Problem in connecting the Remote Bluetooth

Part Number: TM4C129XNCZAD
Other Parts Discussed in Thread: CC256XM4BTBLESW

Hi,

I am working on Tm4c129xnczad controller. I am using SPPLE demo program to connect remote Bluetooth. It has Bluetooth address "  30ae7bc71efc ".So i tried to connect the remote Bluetooth  using the function such as ConnectLE(NULL);
DiscoverSPPLE(NULL);
ConfigureSPPLE(NULL);  so i am getting  output as Connection Request successful.
No Device Info in discoverspple.
No Device Info in config.

Can you please tell me why i am not able to connect the remote Bluetooth. I am here by sharing the code please tell me how to resolve the issue.

static int ConnectLE(ParameterList_t *TempParam)
{
int ret_val;
BD_ADDR_t BD_ADDR;
GAP_LE_Address_Type_t Address_Type;
// char BT_address[12] = "f43538fe9c18";
// char BT_address[12] = "d78206cba936";
char RT_address[12] = "30ae7bc71efc";


/* First, check that valid Bluetooth Stack ID exists. */
if(BluetoothStackID)
{
/* Next, make sure that a valid device address exists. */
// if((TempParam) && (TempParam->NumberofParameters > 0) && (TempParam->Params[0].strParam) && (BTPS_StringLength(TempParam->Params[0].strParam) >= (sizeof(BD_ADDR_t)*2)))
// {
/* Check to see if the address type is specified. */
// if(TempParam->NumberofParameters >= 2)
// {
// if(TempParam->Params[1].intParam)
// Address_Type = latRandom;
// else
// Address_Type = latPublic;
// }
// else
Address_Type = latRandom;

/* Convert the parameter to a Bluetooth Device Address. */
StrToBD_ADDR(RT_address, &BD_ADDR);
// StrToBD_ADDR(Don_Address, &BD_ADDR);


if(!ConnectLEDevice(BluetoothStackID, Address_Type, BD_ADDR, FALSE))
ret_val = 0;
else
ret_val = FUNCTION_ERROR;
// }
// else
// {
/* Invalid parameters specified so flag an error to the user. */
// DisplayUsage("ConnectLE [BD_ADDR] [Address Type (0 = Public/Default, 1 = Random) Optional]");

/* Flag that an error occurred while submitting the command. */
// ret_val = INVALID_PARAMETERS_ERROR;
// }
}
else
{
/* No valid Bluetooth Stack ID exists. */
ret_val = INVALID_STACK_ID_ERROR;
}

return(ret_val);
}

static int DiscoverSPPLE(ParameterList_t *TempParam)
{
int ret_val;
int LEConnectionIndex;
BD_ADDR_t BD_ADDR;
GATT_UUID_t UUID[1];
DeviceInfo_t *DeviceInfo;
//char BT_address[12] = "f43538fe9c18";
// char BT_address[12] = "d78206cba936";
char RT_address[12] = "30ae7bc71efc";

/* Next, make sure that a valid device address exists. */
// if((TempParam) && (TempParam->NumberofParameters > 0) && (TempParam->Params[0].strParam) && (BTPS_StringLength(TempParam->Params[0].strParam) >= (sizeof(BD_ADDR_t)*2)))
// {
/* Convert the parameter to a Bluetooth Device Address. */
StrToBD_ADDR(RT_address, &BD_ADDR);

/* Find the LE Connection Index for this connection. */
if((LEConnectionIndex = FindLEIndexByAddress(BD_ADDR)) >= 0)
{
/* Get the device info for the connection device. */
if((DeviceInfo = SearchDeviceInfoEntryByBD_ADDR(&DeviceInfoList, LEContextInfo[LEConnectionIndex].ConnectionBD_ADDR)) != NULL)
{
/* Verify that no service discovery is outstanding for this */
/* device. */
if(!(DeviceInfo->Flags & DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING))
{
/* Configure the filter so that only the SPP LE Service */
/* is discovered. */
UUID[0].UUID_Type = guUUID_128;
SPPLE_ASSIGN_SPPLE_SERVICE_UUID_128(&(UUID[0].UUID.UUID_128));

/* Start the service discovery process. */
ret_val = GATT_Start_Service_Discovery(BluetoothStackID, LEContextInfo[LEConnectionIndex].ConnectionID, (sizeof(UUID)/sizeof(GATT_UUID_t)), UUID, GATT_Service_Discovery_Event_Callback, 0);
if(!ret_val)
{
/* Display success message. */
Display(("GATT_Start_Service_Discovery success.\r\n"));

/* Flag that a Service Discovery Operation is */
/* outstanding. */
DeviceInfo->Flags |= DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING;
}
else
{
/* An error occur so just clean-up. */
Display(("Error - GATT_Start_Service_Discovery returned %d.\r\n", ret_val));

ret_val = FUNCTION_ERROR;
}
}
else
{
Display(("Service Discovery Operation Outsanding for Device.\r\n"));

ret_val = FUNCTION_ERROR;
}
}
else
{
Display(("No Device Info in discoverspple.\r\n"));

ret_val = FUNCTION_ERROR;
}
}
else
{
/* No matching ConnectionBD_ADDR. */
Display((" connection with BD_ADDR %s exists.\r\n", RT_address));

ret_val = FUNCTION_ERROR;
}
// }
// else
//{
/* Invalid parameters specified so flag an error to the user. */
// Display(("Usage: DiscoverSPPLE [BD_ADDR].\r\n"));

/* Flag that an error occurred while submitting the command. */
// ret_val = INVALID_PARAMETERS_ERROR;
//}

return(ret_val);
}

static int ConfigureSPPLE(ParameterList_t *TempParam)
{
int ret_val;
int LEConnectionIndex;
BD_ADDR_t BD_ADDR;
DeviceInfo_t *DeviceInfo;
// char BT_address[12] = "f43538fe9c18";
// char BT_address[12] = "d78206cba936";
char RT_address[12] = "30ae7bc71efc";


/* Next, make sure that a valid device address exists. */
// if((TempParam) && (TempParam->NumberofParameters > 0) && (TempParam->Params[0].strParam) && (BTPS_StringLength(TempParam->Params[0].strParam) >= (sizeof(BD_ADDR_t)*2)))
// {
/* Convert the parameter to a Bluetooth Device Address. */
StrToBD_ADDR(RT_address, &BD_ADDR);

/* Find the LE Connection Index for this connection. */
if((LEConnectionIndex = FindLEIndexByAddress(BD_ADDR)) >= 0)
{
/* Get the device info for the connection device. */
if((DeviceInfo = SearchDeviceInfoEntryByBD_ADDR(&DeviceInfoList, LEContextInfo[LEConnectionIndex].ConnectionBD_ADDR)) != NULL)
{
/* Determine if a service discovery operation has been */
/* previously done. */
//if(SPPLE_CLIENT_INFORMATION_VALID(DeviceInfo->ClientInfo))
//{
Display(("SPPLE Service found on remote device, attempting to read Transmit Credits, and configured CCCDs.\r\n"));

/* Send the Initial Credits to the remote device. */
SPPLESendCredits(&(LEContextInfo[LEConnectionIndex]), DeviceInfo, LEContextInfo[LEConnectionIndex].SPPLEBufferInfo.ReceiveBuffer.BytesFree);

/* Enable Notifications on the proper characteristics. */
EnableDisableNotificationsIndications(LEContextInfo[LEConnectionIndex].ConnectionID, DeviceInfo->ClientInfo.Rx_Credit_Client_Configuration_Descriptor, GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_NOTIFY_ENABLE, GATT_ClientEventCallback_SPPLE);
EnableDisableNotificationsIndications(LEContextInfo[LEConnectionIndex].ConnectionID, DeviceInfo->ClientInfo.Tx_Client_Configuration_Descriptor, GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_NOTIFY_ENABLE, GATT_ClientEventCallback_SPPLE);

ret_val = 0;
// }
//else
//{
// Display(("No SPPLE Service discovered on device.\r\n"));

//ret_val = FUNCTION_ERROR;
//}
}
else
{
Display(("No Device Info in config.\r\n"));

ret_val = FUNCTION_ERROR;
}
}
else
{
/* No matching ConnectionBD_ADDR. */
Display((" connection with BD_ADDR %s exists.\r\n", RT_address));

ret_val = FUNCTION_ERROR;
}
//}
// else
// {
/* Invalid parameters specified so flag an error to the user. */
// Display(("Usage: ConfigureSPPLE [BD_ADDR].\r\n"));

/* Flag that an error occurred while submitting the command. */
//ret_val = INVALID_PARAMETERS_ERROR;
//}

return(ret_val);
}