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.

[参考译文] CC2640R2F:CC2640R2F 外设在发送 GATT_WriteNoRsp 命令后崩溃

Guru**** 2590990 points
Other Parts Discussed in Thread: CC2640R2F, SYSBIOS

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/607043/cc2640r2f-cc2640r2f-peripheral-crash-after-sending-gatt_writenorsp-command

器件型号:CC2640R2F
Thread 中讨论的其他器件: SYSBIOS

尊敬的先生:

我尝试使用 GATT_WriteNoRsp 命令编写一个函数、使 CC2640R2F 外设在 BLE 中央设备上写入字符。 功能如下。

连接句柄和字符句柄已被正确获取。 BLE 堆栈映像在编译时删除了 GATT_NO_CLIENT 定义。

当函数运行时、GATT_WriteNoRsp 的返回值为 Success。 我也可以通过数据包监听器捕获正确的 ATT 数据包。

但是、当程序运行到 Event_post 时、它会崩溃并跳转到 ti_sysbios_family_arm_m3/Hwi_exHandler。 如果 GATT_WriteNoRsp 未运行、则 Event_post 将正确运行。

我花了几天的时间尝试找出发生了什么、但到目前为止没有取得任何进展。 非常感谢您、如果有人能提供帮助或提供一些线索。

静态 gattMsg_t t_Message;

静态 uint16 U16_ConnectionHandle;

静态 uint16 U16_CharacterHandle;

静态 iCall_SyncHandle t_ICallSyncHandle;

静态 iCall_EntityID t_ICallEntityID;

#define EVENT_WRITE (1 <<0)


void ProcessTask (UArg0、UArg1)
{
uint32_t t_EVENTs;


iCall_registerApp (&t_ICallEntityID、&t_ICallSyncHandle);


while (1)
{
T_Events = Event_pend (t_ICallSyncHandle、Event_ID_NONE、
EVENT_WRITE、ICALL_TIMEOUT_FOREVENT);

//执行某些

操作}
}


uint GATT_Write (const uint8 * u8p_Data、uint8 u8_Length)
{
attWriteReq_t * tp_WriteRequest;

TP_WriteRequest =&t_Message.writeReq;

TP_WriteRequest->pValue =(uint8 *) GATT_BM_alloc (U16_ConnectionHandle、ATT_WRITE_REQ、(uint16) u8_Length、NULL);

if (tp_WriteRequest->pValue!= NULL)
{
tp_WriteRequest->len = u8_Length;
TP_WriteRequest->SIG = 0;
TP_WriteRequest->cmd = 1;
memcpy (tp_WriteRequest->pValue、u8p_Data、u8_Length);
TP_WriteRequest->Handle = U16_CharacterHandle;

if (GATT_WriteNoRsp (U16_ConnectionHandle、tp_WriteRequest)!=成功)
{
GATT_BM_FREE (&t_Message、ATT_WRITE_REQ);
返回 Function_FAIL;
}
}

Event_POST (t_ICallSyncHandle、EVENT_WRITE);

返回函数_OK;

}