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.

Bluetooth reinitialization issues

My project requires that I shut down the PAN1325 chip, using the SHDN line, to save battery power when in "power off" mode.  On initial power up, the BT initializes every time, but on the reinit I always see BSC_Initialize return an error of -14 (BTPS_ERROR_HCI_DRIVER_ERROR).  The code I use for BT init and BT shutdown are provided below.

What do I need to add to the code to ensure a clean shutdown and reinitialize of the Bluetooth?

Power up Initialize and  Reinitialize after "power off" mode:

static int
DoBluetoothInitialization( void )
{
  BTPS_Initialization_t  sBTPSInitialization;
  tDeviceInfo            sDeviceInfo;
  int                    iRetVal;

  // Set the callback function the stack can use for printing to the
  // console to NULL, as we have no console to send to.
  //
  sBTPSInitialization.MessageOutputCallback = NULL;

  // use standard bluetopia eval code function in bluetooth.c
  iRetVal = InitializeBluetooth(BluetoothCallbackFunction, NULL, &sBTPSInitialization);

  if(!iRetVal)
  {
    // Make the device Connectable and Discoverable
    // Enable Secured Simple Pairing.
    //
    SetLocalDeviceMode(CONNECTABLE_MODE  | DISCOVERABLE_MODE | PAIRABLE_SSP_MODE);

    // Get information about our local device.
    //
    iRetVal = GetLocalDeviceInformation(&sDeviceInfo);
  }
  g_BTInitialized = true;
  return( iRetVal );
}

//-----------------------------------------------------

static int
DoBluetoothShutdown( void )
{
  int                    iRetVal;

  // No need to unregister a mesage output callback, so skip that.

  BSC_Shutdown();             // void function, no return val
  g_BTInitialized = false;
  return( 0 );
}

Call to shutdown is followed by setting the SHDN line to the PAN1325 low, activating shutdown mode.

Call to init is preceeded by setting the SHDN line to the pan1325 high, enabling the device.  it is guaranteed that at least 5ms between SHDN low and SHDN high is provided, as per Panasonic documents, to ensure the PAN1325 is reset.

Ron