Hello,
I'm working on 2 multi_role base projects, although one acts as a client and another as a server. My SDK is CC13xx CC26xx 7.10.00.98 and I'm using 2 LP-CC2651R3SIPA.
My goal is to receive readings within a range of 0,5 to 1 second in order to update data in the client project as quickly as possible as it happens in the server (time is sitting between 1,8-2,2 seconds now, too slow). I am reading correct data, and I can lower the amount of data read or change some data types, if that's what I have to do. Display methods will also not be needed as currently It's only for my debug purposes, if that makes it feel slower.
I have a client where I am using GATT_ReadMultiCharValues in the multi_role_performPeriodicTask method, I've managed to set MR_PERIODIC_EVT_PERIOD to as low as 1000 without spinlock issues, but when it is set to 800 or lower (haven't tested other values between 1000 and 800), the error appears, and then the AssertHandler executes with parameters "assertCause" as 8 and "assertSubcause" as 0 (no matter the time I set sub-800 as MR_PERIODIC_EVT_PERIOD). Although the periodic event happens once each second, I get results each 1,8-2,2 seconds (approximately, calculated by telephone's chronometer) which is too slow for the purpose. Once It is sub-800, the program displays DEFAULT SPINLOCK! and becomes unresponsive.
Reading a lower amount of characteristics with MR_PERIODIC_EVT_PERIOD as 800 (or lower) doesn't help either, as the same error codes appear.
The code in multi_role_performPeriodicTask is as follows:
static void multi_role_performPeriodicTask(void)
{
if (debug_isGATTavailable) {
attReadMultiReq_t reqMulti;
reqMulti.numHandles = 2;
reqMulti.pHandles = GATT_bm_alloc(mrConnHandle, ATT_READ_MULTI_REQ, 4, NULL);
reqMulti.pHandles[0] = LO_UINT16(connList[0].charHandle);
reqMulti.pHandles[1] = HI_UINT16(connList[0].charHandle);
reqMulti.pHandles[2] = LO_UINT16(connList[0].charHandle + 3);
reqMulti.pHandles[3] = HI_UINT16(connList[0].charHandle + 3);
reqMulti.pHandles[4] = LO_UINT16(connList[0].charHandle + 6);
reqMulti.pHandles[5] = HI_UINT16(connList[0].charHandle + 6);
reqMulti.pHandles[6] = LO_UINT16(connList[0].charHandle + 9);
reqMulti.pHandles[7] = HI_UINT16(connList[0].charHandle + 9);
reqMulti.pHandles[8] = LO_UINT16(connList[0].charHandle + 12);
reqMulti.pHandles[9] = HI_UINT16(connList[0].charHandle + 12);
reqMulti.pHandles[10] = LO_UINT16(connList[0].charHandle + 15);
reqMulti.pHandles[11] = HI_UINT16(connList[0].charHandle + 15);
reqMulti.pHandles[12] = LO_UINT16(connList[0].charHandle + 18);
reqMulti.pHandles[13] = HI_UINT16(connList[0].charHandle + 18);
bStatus_t status = FAILURE;
while (status != SUCCESS)
{
if (status == blePending) {
break;
}
status = GATT_ReadMultiCharValues(mrConnHandle, &reqMulti, selfEntity);
Display_print1(dispHandle, MR_ROW_CHAR_1, 0, "Read multi char status - %d", status);
}
Display_printf(dispHandle, MR_ROW_CHAR_1, 0, "Success. Status - %d", status);
GATT_bm_free( (gattMsg_t *) &reqMulti, ATT_READ_MULTI_REQ);
}
}
The part of the code that handles the responses (in multi_role_processGATTMsg) is as follows. Currently I am reading 1-byte characteristic and 5 4-byte characteristics (which I convert into a uint32_t after):
static uint8_t multi_role_processGATTMsg(gattMsgEvent_t *pMsg)
{
// Get connection index from handle
uint8_t connIndex = multi_role_getConnIndex(pMsg->connHandle);
MULTIROLE_ASSERT(connIndex < MAX_NUM_BLE_CONNS);
if (pMsg->method == ATT_FLOW_CTRL_VIOLATED_EVENT)
{
// ATT request-response or indication-confirmation flow control is
// violated. All subsequent ATT requests or indications will be dropped.
// The app is informed in case it wants to drop the connection.
// Display the opcode of the message that caused the violation.
Display_printf(dispHandle, MR_ROW_CUR_CONN, 0, "FC Violated: %d",
pMsg->msg.flowCtrlEvt.opcode);
}
else if (pMsg->method == ATT_MTU_UPDATED_EVENT)
{
// MTU size updated
Display_printf(dispHandle, MR_ROW_CUR_CONN, 0, "MTU Size: %d",
pMsg->msg.mtuEvt.MTU);
}
// Messages from GATT server
if (linkDB_Up(pMsg->connHandle))
{
if ( ... other conditions checking other kind of responses) {
// methods just as the original code in multi_role is
}
else if (((pMsg->method == ATT_READ_MULTI_RSP) && (pMsg->msg.readMultiRsp.len > 0))
|| ((pMsg->method == ATT_ERROR_RSP) && (pMsg->msg.errorRsp.reqOpcode == ATT_READ_MULTI_REQ)))
{
if (pMsg->method == ATT_ERROR_RSP)
{
Display_printf(dispHandle, MR_ROW_CHAR_2, 0, "ATT ERROR reqOpCode: %d, errCode: %d", pMsg->msg.errorRsp.reqOpcode, pMsg->msg.errorRsp.errCode);
}
else
{
Display_printf(dispHandle, MR_ROW_CHAR_2, 0,
"ATT_READ_MULTI_RSP, len: %d: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
pMsg->msg.readMultiRsp.len,
pMsg->msg.readMultiRsp.pValues[0], pMsg->msg.readMultiRsp.pValues[1],
pMsg->msg.readMultiRsp.pValues[2], pMsg->msg.readMultiRsp.pValues[3],
pMsg->msg.readMultiRsp.pValues[4], pMsg->msg.readMultiRsp.pValues[5],
pMsg->msg.readMultiRsp.pValues[6], pMsg->msg.readMultiRsp.pValues[7],
pMsg->msg.readMultiRsp.pValues[8], pMsg->msg.readMultiRsp.pValues[9],
pMsg->msg.readMultiRsp.pValues[10], pMsg->msg.readMultiRsp.pValues[11],
pMsg->msg.readMultiRsp.pValues[12], pMsg->msg.readMultiRsp.pValues[13],
pMsg->msg.readMultiRsp.pValues[14], pMsg->msg.readMultiRsp.pValues[15],
pMsg->msg.readMultiRsp.pValues[16], pMsg->msg.readMultiRsp.pValues[17]);
uint8_t resp_char1 = 0;
uint32_t resp_char2 = 0;
uint32_t resp_char3 = 0;
uint32_t resp_char4 = 0;
uint32_t resp_char5 = 0;
uint32_t resp_char6 = 0;
// Converting values
resp_char1 = pMsg->msg.readMultiRsp.pValues[0];
Util_convertUInt8arrToUInt32(&resp_char2, pMsg->msg.readMultiRsp.pValues, 1);
Util_convertUInt8arrToUInt32(&resp_char3, pMsg->msg.readMultiRsp.pValues, 5);
Util_convertUInt8arrToUInt32(&resp_char4, pMsg->msg.readMultiRsp.pValues, 9);
Util_convertUInt8arrToUInt32(&resp_char5, pMsg->msg.readMultiRsp.pValues, 13);
Util_convertUInt8arrToUInt32(&resp_char6, pMsg->msg.readMultiRsp.pValues, 17);
Display_printf(dispHandle, MR_ROW_CHAR_1, 0, "[1]=%u, [2]=%u, [3]=%u, [4]=%u, [5]=%u, [6]=%u", resp_char1, resp_char2, resp_char3, resp_char4, resp_char5, resp_char6);
}
I am a bit stuck on where to head to improve as I'm not exactly sure what is causing the DEFAULT SPINLOCK error to appear or how I can improve the reception speeds. I haven't modified much parameters from syscfg or know which documentation (from here) I need to read in order to know how to improve this part.
Edit: I also tried to only read a characteristic but timing is the same, takes more than 2-3 seconds to start and then it keeps receiving data each ~2 seconds.
Any help will be greatly appreciated and with any further details do not hesitate to ask.
Thank you in advance


