主题中讨论的其他器件:CC2564MODA、 CC2564、
您好!
我正在我的项目中使用 CC2564MODA 蓝牙模块、来自 CC2564_Bluetopia 堆栈。我正在使用 SPPDEMO 配置文件、一切都正确。 将代码加载到我的套件后、蓝牙正在广播、但它未配对器件、我不知道突然发生了什么、您能帮助这方面的任何人吗? 如何解决该问题。 我跳你的人会帮助这个。 我正在等待您的快速响应。
提前感谢。
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.
您好!
我正在我的项目中使用 CC2564MODA 蓝牙模块、来自 CC2564_Bluetopia 堆栈。我正在使用 SPPDEMO 配置文件、一切都正确。 将代码加载到我的套件后、蓝牙正在广播、但它未配对器件、我不知道突然发生了什么、您能帮助这方面的任何人吗? 如何解决该问题。 我跳你的人会帮助这个。 我正在等待您的快速响应。
提前感谢。
大家好、Jansi、为了更好地帮助您并了解您的问题、您可以 按照以下说明使用这些工具 WiLink-BT 提供日志: 蓝牙记录器和链路质量监控器(LQM)工具(修订版 D)(TI.com)。 另请告知我们有关您的设置的更多信息、如主机器件、补丁版本等
大家好、Jansi、我所说的补丁版本我指的是此链接中的文件: CC256XB-BT-SP 驱动程序或库| TI.com、这些是修复错误并帮助配置 CC2564MODA 的必要初始化文件。 此外、我假设主机器件的票证名称、负责通过 UART/HCI 与 CC2564MODA 通信的器件是 TM4C129XNCZAD。
要更改广播的名称,请参阅 SPPDemo.c 中的 SetLocalName()函数 该函数特别关注 SDK 中的 GAP_SET_LOCAL_Device_Name、该字符串应当能够设置本地设备的名称。
Jansi、大家好、GAP_SET_LOCAL_Device_Name 函数只会更改器件所广播的名称、不会与器件配对、这是一个单独的函数。
本文档末尾介绍了演示中使用的每个通用访问配置文件(GAP)功能。 例如、按照演示的说明:查询了哪些蓝牙设备可见后、该演示会调用以下函数、该函数获取目标设备的蓝牙地址。
int BTPSAPI SPP_Open_Remote_Port (unsigned int BluetoothStackID、BD_ADDR_t BD_ADDR、unsigned int ServerPort、SPP_Event_Callback_t SPP_Event_Callback、unsigned long CallbackParameter);
您好!
无论你提供的文件,我提到,然后我实施了以下两个功能,但仍然没有配对。 请帮助我使用哪个函数来使用 sppdemo 配置文件进行器件配对。
GAP_SET_LOCAL_Device_Name (BluetoothStackID、"MyDeviceName");
GAP_Authentication_Response (BluetoothStackID、BD_ADDR、(uint32_t *)&Passkey);
您好 Daniel Oils:
上述内容在我的代码中已经介绍过、但仍然无法确定是什么问题、以及为什么无法对器件进行配对。
static int Pair(ParameterList_t *TempParam) {
int Result;
int ret_val;
GAP_Bonding_Type_t BondingType;
Display(("pair------1685"));
/* First, check that valid Bluetooth Stack ID exists. */
if (BluetoothStackID) {
/* Next, make sure that we are not already connected. */
if (!Connected) {
/* There are currently no active connections, make sure that */
/* all of the parameters required for this function appear to */
/* be at least semi-valid. */
if ((TempParam) &&(TempParam->NumberofParameters > 0)
&& (TempParam->Params[0].intParam)
&& (NumberofValidResponses) &&(TempParam->Params[0].intParam
<= NumberofValidResponses)
&& (!COMPARE_BD_ADDR(
InquiryResultList[(TempParam->Params[0].intParam - 1)],
NullADDR))) {
/* Check to see if General Bonding was specified. */
if (TempParam->NumberofParameters > 1)
BondingType =
TempParam->Params[1].intParam ?
btGeneral : btDedicated;
else
BondingType = btDedicated;
/* Before we submit the command to the stack, we need to */
/* make sure that we clear out any Link Key we have stored */
/* for the specified device. */
DeleteLinkKey(
InquiryResultList[(TempParam->Params[0].intParam - 1)]);
/* Attempt to submit the command. */
Result = GAP_Initiate_Bonding(BluetoothStackID,
InquiryResultList[(TempParam->Params[0].intParam - 1)],
BondingType, GAP_Event_Callback, (unsigned long) 0);
/* Check the return value of the submitted command for */
/* success. */
if (!Result) {
/* Display a messsage indicating that Bonding was */
/* initiated successfully. */
Display(
("GAP_Initiate_Bonding(%s): Success.\r\n", (BondingType == btDedicated)?"Dedicated":"General"));
/* Flag success to the caller. */
ret_val = 0;
} else {
/* Display a message indicating that an error occured */
/* while initiating bonding. */
DisplayFunctionError("GAP_Initiate_Bonding", Result);
ret_val = FUNCTION_ERROR;
}
} else {
/* One or more of the necessary parameters is/are invalid. */
DisplayUsage(
"Pair [Inquiry Index] [0 = Dedicated, 1 = General (optional)]");
ret_val = INVALID_PARAMETERS_ERROR;
}
} else {
/* Display an error to the user describing that Pairing can */
/* only occur when we are not connected. */
Display(("Only valid when not connected.\r\n"));
ret_val = FUNCTION_ERROR;
}
} else {
/* No valid Bluetooth Stack ID exists. */
ret_val = INVALID_STACK_ID_ERROR;
}
return (ret_val);
}
我将附上我的代码,请你一遍。
静态 int 对(PARAMETERLIST_t * TempParam){
INT 结果;
int ret_val;
GAP_Bond_Type_t 绑定类型;
显示器("配对------ 1685英寸));
/*首先,检查是否存在有效的蓝牙堆栈 ID。 */
如果(BluetoothStackID){
/*接下来,确保我们尚未连接。 */
如果(!connected){
/*当前没有活动的连接,请确保*/
/*此函数所需的所有参数都显示为*/
/*至少为半有效。 */
if ((TempParam)&&(TempParam -> NumberofParameters > 0)
&&(TempParam->Params[0].intParam)
&&(NumberofValidResponse)&&(TempParam->Params[0].intParam
<= ValidResponse 的数目)
&&(!COMPARE_BD_ADDR (
InquiryResultList[(TempParam->Params[0].intParam - 1)],
NullADDR)){
/*检查是否指定了通用绑定。 */
if (TempParam->NumberofParameters > 1)
绑定类型=
TempParam->Params[1].intParam?
一般情况:已达格;
方案
绑定类型=绑定;
/*在向堆栈提交命令之前,我们需要*/
/*确保清除已存储的任何链接密钥*/
/*表示指定设备。 */
DeleteLinkKey(
InquiryResultList[(TempParam->Params[0].intParam - 1)];
/*尝试提交命令。 */
结果= GAP_Initiate_Bonding (BluetoothStackID、
InquiryResultList[(TempParam->Params[0].intParam - 1)],
BondingType、GAP_Event_Callback、(unsigned long) 0);
/*检查已提交命令的返回值*/
/*成功。 */
如果(!RESULT){
/*显示消息,表示绑定为*/
/*已成功启动。 */
显示(
("GAP_Initiate_Bonding (%s):成功。\r\n "、(BondingType == btDedated)?"专用":"常规");
/*标记呼叫者成功。 */
RET_val = 0;
}其他{
/*显示指示发生错误的消息*/
/*启动绑定时。 */
DisplayFunctionError ("GAP_Initiate_Bonding"、Result);
RET_val = FUNCTION_ERROR;
}
}其他{
/*一个或多个必要参数无效。 */
DisplayUsage(
"配对[查询索引][0 =专用、1 =通用(可选)]";
RET_val = INVALID_PARAMS_ERROR;
}
}其他{
/*向用户显示一个错误,描述配对可以*/
/*仅在未连接时发生。 */
显示("仅在未连接时有效。\r\n);
RET_val = FUNCTION_ERROR;
}
}其他{
/*不存在有效的蓝牙堆栈 ID。 */
RET_val = INVALID_STACK_ID_ERROR;
}
返回(ret_val);
}