主题中讨论的其他器件: SysConfig
工具与软件:
您好!
我正在使用 CC2642R、以利用 BLE 并将 UART 数据发送到另一个控制器。 我已在某个特征的读取回调中插入了用户定义的函数。 数据已成功存储在存储器位置。 但是、当我尝试调用另一个通过 UART 发送特定数据的用户定义函数时、程序会卡在 HAL_ASSERT_SPINLOCK 中。 可能的原因是什么?
我的代码:
-->我的写回调函数:
bStatus_t simpleProfile_WriteAttrCB(uint16_t connHandle,
gattAttribute_t *pAttr,
uint8_t *pValue, uint16_t len,
uint16_t offset, uint8_t method)
{
bStatus_t status = SUCCESS;
uint8 notifyApp = 0xFF;
if ( pAttr->type.len == ATT_BT_UUID_SIZE )
{
// 16-bit UUID
uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);
switch ( uuid )
{
case SIMPLEPROFILE_CHAR3_UUID:
// Validate the value
// Make sure it's not a blob operation
if ( offset == 0 )
{
if ( len > 40 )
{
status = ATT_ERR_INVALID_VALUE_SIZE;
}
}
else
{
status = ATT_ERR_ATTR_NOT_LONG;
}
//Write the value
if ( status == SUCCESS )
{
uint8 *pCurValue = (uint8 *)pAttr->pValue;
*pCurValue = pValue[0];
inputSize = len;
for(int i = 0; i < len;i++)
{
completePacket[counter] = pValue[i];
counter = counter + 1;
if(counter == 256)
{
counter = 0;
packetWriteFlag = 1;
break;
}
}
if(packetWriteFlag == 1)
{
cloud_packet_decode_and_decrypt(completePacket);
app_command_parse_and_generate_new(completePacket);
counter = 0;
packetWriteFlag = 0;
}
//value_validator(input);
// app_command_parse_and_generate_new(input,len);
// notifyApp = SIMPLEPROFILE_CHAR3;
}
break;
case SIMPLEPROFILE_CHAR1_UUID:
// Validate the value
// Make sure it's not a blob operation
if ( offset == 0 )
{
if ( len > 40 )
{
status = ATT_ERR_INVALID_VALUE_SIZE;
}
}
else
{
status = ATT_ERR_ATTR_NOT_LONG;
}
//Write the value
if ( status == SUCCESS )
{
uint8 *pCurValue = (uint8 *)pAttr->pValue;
*pCurValue = pValue[0];
inputSize = len;
for(int i = 0; i < len;i++)
{
input[i] = pValue[i];
}
if(splitFlag == 1)
{
// app_command_parse_and_generate_new(decryptedCloudInput);
commandImplementFlag = 1;
splitFlag = 0;
}
// else if(commandImplementFlag == 1)
// {
// //uart_and_RS485("probe");
// //uart_and_RS485("probe");
//
// // sem_post(&sem1);
// //commandImplementFlag = 0;
// }
else
{
check_other_command(input,1);
}
if(input[0] == '0')
{
memset(completePacket,0,260);
counter = 0;
}
}
break;
case GATT_CLIENT_CHAR_CFG_UUID:
status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,
offset, GATT_CLIENT_CFG_NOTIFY );
break;
default:
// Should never get here! (characteristics 2 and 4 do not have write permissions)
status = ATT_ERR_ATTR_NOT_FOUND;
break;
}
}
else
{
// 128-bit UUID
status = ATT_ERR_INVALID_HANDLE;
}
// // If a characteristic value changed then callback function to notify application of change
// if ( (notifyApp != 0xFF ) && simpleProfile_AppCBs && simpleProfile_AppCBs->pfnSimpleProfileChange )
// {
// simpleProfile_AppCBs->pfnSimpleProfileChange(2);
// }
return ( status );
}cloud_packet_decode_and_decrypt(completePacket);
APP_COMMAND_PARSE_AND_GENERATE_NEW (completePacket);
这是我将在 BLE 的写入回调函数中插入的2个函数。 现在、仅保留第一个函数、器件运行良好、但添加第二个函数后会出现问题...
有人能指出我在 处理问题时移动的方向吗?