Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hello,
I am using CC2642R for utilizing BLE and sending UART data to another controller. I have inserted a user defined function in the read callback of a certain characteristic. The data is successfully being stored in the memory location. However when i try to call another user defined function that sends certain data via UART, the program gets stuck in the HAL_ASSERT_SPINLOCK. What can be the possible reasons for this ?
My code:
--> My write callback function:
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);
These are the 2 functions which i am inserting in the write callback function of BLE. Now by only keeping the first function, the device works perfectly but after adding the second function issues occur...
Can anyone point me in the direction in which to move while approaching the problem ??