Other Parts Discussed in Thread: CC2564MODN
Hi,
I am running Bluetopia 1.2 R2 with dual mode chip CC2564modn
I need to close and reopen the stack. That's what I do:
int CloseStack(void)
{
int ret_val = 0;
/* First check to see if the Stack has been opened. */
if (BluetoothStackID)
{
/* Cleanup GAP Service Module. */
if (GAPSInstanceID) {
GAPS_Cleanup_Service(BluetoothStackID, GAPSInstanceID);
GAPSInstanceID = 0;
}
/* Un-registered SPP LE Service. */
if (GPSLEServiceID) {
GATT_Un_Register_Service(BluetoothStackID, GPSLEServiceID);
GPSLEServiceID = 0;
}
/* Cleanup GATT Module. */
GATT_Cleanup(BluetoothStackID);
/* Simply close the Stack */
BSC_Shutdown(BluetoothStackID);
/* Free BTPSKRNL allocated memory. */
BTPS_DeInit();
Display(("Stack Shutdown.\r\n"));
/* Free the Key List. */
FreeDeviceInfoList(&DeviceInfoList);
/* Flag that the Stack is no longer initialized. */
BluetoothStackID = 0;
/* Flag success to the caller. */
ret_val = 0;
}
else
{
/* A valid Stack ID does not exist, inform to user. */
ret_val = UNABLE_TO_INITIALIZE_STACK;
}
return (ret_val);
}
I have noticed that HCITR_COMClose(); is not called.
So when I reopen the stack I got BTPS_ERROR_HCI_DRIVER_ERROR from BSC_Initialize
When I manually call HCITR_COMClose() then It kind of works but Bluetopia is runnig ot of memory
mallock error.
What is the correct procedure to close and reopen the Bluetopia stack?
Regards
Rafal Witelus
