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.

CC2564MODA: CC2564MODA: BSC_Shutdown hangs on CC256x with Segger embOS(& STM32L476RGT)

Part Number: CC2564MODA
Other Parts Discussed in Thread: CC256XSTBTBLESW

Sometimes the controller get stuck in function "BSC_Shutdown" (see flow below).

This happens only sometimes, with no specific schema (~ 1 out of 20). The function "BSC_Shutdown" has some callbacks "HCITR_COMReconfigure" and "HCITR_COMClose", this funcations are called in case of success. In case of an error theis functions are not called and the controller stays forever in the function "BSC_Shutdown".

In case it stays there, the function "HCISendPacket" and "HCITR_COMDataCallback_UART" is called frequently.

I'm using the stack "CC256XSTBTBLESW_4.2.1.1" and the service pack V1.8 (CC256XB.h).

CloseStack flow:

/* First check to see if the Stack has been opened. */
if(StaticBluetoothStackID)
{
    /* Cleanup GAP Service Module. */
    if(GAPSInstanceID)
   { 
       GAPS_Cleanup_Service(StaticBluetoothStackID, GAPSInstanceID);
   }

   /* Un-registered SPP LE Service. */
   if(SPPLEServiceID)
   {
       GATT_Un_Register_Service(StaticBluetoothStackID, SPPLEServiceID);
       SPPLEServiceID = 0;
   }

    /* Cleanup GATT Module. */
    GATT_Cleanup(StaticBluetoothStackID);

    /* Simply close the Stack */
    BSC_Shutdown(StaticBluetoothStackID);

    /* Free BTPSKRNL allocated memory. */
    BTPS_DeInit();

    Display(("Stack Shutdown."));

    /* Free the Key List. */
    FreeDeviceInfoList(&DeviceInfoList);

    /* Flag that the Stack is no longer initialized. */
    StaticBluetoothStackID = 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;
}