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.

CC2564: High power draw with PAN1326 running modified SPPLE Demo Lite

Part Number: CC2564
Other Parts Discussed in Thread: MSP430F2418,

Based on the PAN1326 datasheet on page 38 the average BLE "Advertising, discoverable" current is 121uA. However, I am measuring an average system current of 800uA. I need to reduce the current draw as much as possible, and need help to achieve the ~130uA that is theoretically possible.

The MSP430F2418 used is in LPM3 and if I assert the nShutdown pin on the PAN1326, board current drops to 15uA. From this I have concluded the current is being drawn by the PAN1326 module, and that it is not entering the correct power state. I am using Bluetopia v1.5 for the stack and the code is based on a modified version of the SPPLE Demo Lite example.

Schematic excerpts are shown below. VBAT is 3.4V and S1 and S2 are jumpers in the VBAT position. I have included my modified SPPLEDemo.c and MainThread() and IdleFunction() implementations below.

/* The following function is responsible for checking the idle state */
/* and possibly entering LPM3 mode.                                  */
static void IdleFunction(void *UserParameter)
{
  if(BLEdataToProcess)
    return; // still work to be done
#ifdef __CONNECTION_TIMEOUT__  
  //if ((ConnectionID != 0) && (connection_timeout != 0))    // 05/23/2017
  if ((ConnectionID != 0) && (flgBLEOperationOn == 1))        // 05/23/2017
  { 
    return;                                    //do not sleep
  }
#endif
  /* If the stack is Idle and we are in HCILL Sleep, then we may enter */
  /* LPM3 mode (with Timer Interrupts disabled).                       */
  if((BSC_QueryStackIdle(BluetoothStackID)) && (SleepEnabled))
  {
    /* Attempt to suspend the UART.                                   */
    if(!HCITR_COMSuspend(0))
    {
      /* Enter MSP430 LPM3 with Timer Interrupts disabled (we will   */
      /* require an interrupt to wake us up from this state).        */
      //HAL_LowPowerMode((unsigned char)FALSE);
#if 1         
      if((BEACON_INT_FLAG ==1) && (Pkt_Rcd ==0) && (RxCount==0) && (RxState==0))
      //if((Pkt_Rcd ==0) && (RxCount==0) && (RxState==0))
      {
        //FRAM_POWEROFF();  //comment out 05/18/2017 // 06/06/2017
        PwrDown_FlashIC(); // ensure flash is powered off
        HAL_LowPowerMode((unsigned char)FALSE);
      }
#else
      HAL_LowPowerMode((unsigned char)FALSE);
#endif
      /* Check to see if a wakeup is in progress (by the Controller).*/
      /* If so we will disable sleep mode so that we complete the    */
      /* process.                                                    */
      if(!HCITR_UartSuspended(0))
        SleepEnabled = FALSE;
    }
    else
    {
      /* Failed to suspend the UART which must mean that the         */
      /* controller is attempting to do a wakeup.  Therefore we will */
      /* flag that sleep mode is disabled.                           */
      SleepEnabled = FALSE;
    }
  }
}


/* The following function is the main user interface thread.  It     */
/* opens the Bluetooth Stack and then drives the main user interface.*/
static void MainThread(void)
{
  int                           Result;
  BTPS_Initialization_t         BTPS_Initialization;
  HCI_DriverInformation_t       HCI_DriverInformation;
  HCI_HCILLConfiguration_t      HCILLConfig;
  HCI_Driver_Reconfigure_Data_t DriverReconfigureData;
  
  /* Flag that sleep is not currently enabled.                         */
  SleepEnabled = FALSE;
  
  /* Configure the UART Parameters.                                    */
  HCI_DRIVER_SET_COMM_INFORMATION(&HCI_DriverInformation, 1, 115200, cpHCILL);
  HCI_DriverInformation.DriverInformation.COMMDriverInformation.InitializationDelay = 100;
  
  /* Set up the application callbacks.                                 */
  BTPS_Initialization.GetTickCountCallback  = GetTickCallback;
  BTPS_Initialization.MessageOutputCallback = DisplayCallback;
  
  /* Initialize the application.                                       */
  if((Result = InitializeApplication(&HCI_DriverInformation, &BTPS_Initialization)) > 0)
  {
    /* Save the Bluetooth Stack ID.                                   */
    BluetoothStackID = (unsigned int)Result;
    
    /* Register a sleep mode callback if we are using HCILL Mode.     */
    if((HCI_DriverInformation.DriverInformation.COMMDriverInformation.Protocol == cpHCILL) || (HCI_DriverInformation.DriverInformation.COMMDriverInformation.Protocol == cpHCILL_RTS_CTS))
    {
      HCILLConfig.SleepCallbackFunction        = HCI_Sleep_Callback;
      HCILLConfig.SleepCallbackParameter       = 0;
      DriverReconfigureData.ReconfigureCommand = HCI_COMM_DRIVER_RECONFIGURE_DATA_COMMAND_CHANGE_HCILL_PARAMETERS;
      DriverReconfigureData.ReconfigureData    = (void *)&HCILLConfig;
      
      /* Register the sleep mode callback.  Note that if this        */
      /* function returns greater than 0 then sleep is currently     */
      /* enabled.                                                    */
      Result = HCI_Reconfigure_Driver(BluetoothStackID, FALSE, &DriverReconfigureData);
      if(Result > 0)
      {
        /* Flag that sleep mode is enabled.                         */
        SleepEnabled = TRUE;
      }
    }
    //FRAM_POWERON(); //comment out 05/18/2017 // 06/06/2017
    //FRAM_POWEROFF(); //comment out 05/18/2017 // 06/06/2017
    BTPS_AddFunctionToScheduler(IdleFunction, NULL, 0);    //FOR MANAGEMENT
    
    if(BTPS_AddFunctionToScheduler(BLEApplication, NULL,5))
      
      /* Add the idle function (which determines if LPM3 may be entered)*/
      /* to the scheduler.                                              */
      //if(BTPS_AddFunctionToScheduler(IdleFunction, NULL, 0))
    {
      /* Loop forever and execute the scheduler.                     */
      while(1)
        
        BTPS_ExecuteScheduler();
    }
  }
}

SPPLEDemo.c

  • Hi ,
    Your query has been assigned to relevant expert. We will get back to you shortly.

    Thanks
    Saurabh
  • Peter,

    The SPPLEDemo_Lite also initializes BT classic for SPP. Please make the device non-connectable, non-discoverable and non-pairable in the SetConnect(), SetDisc() and SetPairable() functions respectively.

    This will stop the page and inquiry scans that contribute to the current consumption when using LE only.

    Best regards,

    Vihang

  • Thank you, making those changes dropped the average current by about 5 times. Unfortunately, the average current is still much higher than the data sheet indicates it should be. With the advertise interval set to 1.28 seconds I am measuring an average current of 245uA. I also tried the new code on a second board with identical results. Do you have any other suggestions to further reduce the current?

    For reference, the SetConnect(), SetDisc(), and SetPairable() functions are now as follows:

    /* The following function is responsible for placing the Local       */
    /* Bluetooth Device into General Discoverablity Mode.  Once in this  */
    /* mode the Device will respond to Inquiry Scans from other Bluetooth*/
    /* Devices.  This function requires that a valid Bluetooth Stack ID  */
    /* exists before running.  This function returns zero on successful  */
    /* execution and a negative value if an error occurred.              */
    static int SetDisc(void)
    {
      int ret_val = 0;
      
      /* First, check that a valid Bluetooth Stack ID exists.              */
      if(BluetoothStackID)
      {
        /* A semi-valid Bluetooth Stack ID exists, now attempt to set the */
        /* attached Devices Discoverablity Mode to General.               */
        ret_val = GAP_Set_Discoverability_Mode(BluetoothStackID, dmNonDiscoverableMode, 0);//dmGeneralDiscoverableMode, 0);
        
        /* Next, check the return value of the GAP Set Discoverability    */
        /* Mode command for successful execution.                         */
        if(!ret_val)
        {
          /* * NOTE * Discoverability is only applicable when we are     */
          /*          advertising so save the default Discoverability    */
          /*          Mode for later.                                    */
          LE_Parameters.DiscoverabilityMode = dmGeneralDiscoverableMode;
        }
        else
        {
          /* An error occurred while trying to set the Discoverability   */
          /* Mode of the Device.                                         */
          DisplayFunctionError("Set Discoverable Mode", ret_val);
        }
      }
      else
      {
        /* No valid Bluetooth Stack ID exists.                            */
        ret_val = INVALID_STACK_ID_ERROR;
      }
      
      return(ret_val);
    }
    
    /* The following function is responsible for placing the Local       */
    /* Bluetooth Device into Connectable Mode.  Once in this mode the    */
    /* Device will respond to Page Scans from other Bluetooth Devices.   */
    /* This function requires that a valid Bluetooth Stack ID exists     */
    /* before running.  This function returns zero on success and a      */
    /* negative value if an error occurred.                              */
    static int SetConnect(void)
    {
      int ret_val = 0;
      
      /* First, check that a valid Bluetooth Stack ID exists.              */
      if(BluetoothStackID)
      {
        /* Attempt to set the attached Device to be Connectable.          */
        ret_val = GAP_Set_Connectability_Mode(BluetoothStackID, cmNonConnectableMode);//cmConnectableMode);
        
        /* Next, check the return value of the                            */
        /* GAP_Set_Connectability_Mode() function for successful          */
        /* execution.                                                     */
        if(!ret_val)
        {
          /* * NOTE * Connectability is only an applicable when          */
          /*          advertising so we will just save the default       */
          /*          connectability for the next time we enable         */
          /*          advertising.                                       */
          LE_Parameters.ConnectableMode = lcmConnectable;
        }
        else
        {
          /* An error occurred while trying to make the Device           */
          /* Connectable.                                                */
          DisplayFunctionError("Set Connectability Mode", ret_val);
        }
      }
      else
      {
        /* No valid Bluetooth Stack ID exists.                            */
        ret_val = INVALID_STACK_ID_ERROR;
      }
      
      return(ret_val);
    }
    static int SetPairable(void)
    {
      
      int Result;
      int ret_val = 0;
      
      /* First, check that a valid Bluetooth Stack ID exists.              */
      if(BluetoothStackID)
      {
        //#ifdef __TAM__                       
        /* Attempt to set the attached device to be pairable.             */
        Result = GAP_Set_Pairability_Mode(BluetoothStackID, pmNonPairableMode);//pmPairableMode);
        
        /* Next, check the return value of the GAP Set Pairability mode   */
        /* command for successful execution.                              */
        if(!Result)
        {
          //#endif        
          /* The device has been set to pairable mode, now register an   */
          /* Authentication Callback to handle the Authentication events */
          /* if required.                                                */
          Result = GAP_Register_Remote_Authentication(BluetoothStackID, GAP_Event_Callback, (unsigned long)0);
          
          /* Next, check the return value of the GAP Register Remote     */
          /* Authentication command for successful execution.            */
          if(!Result)
          {
            /* Now Set the LE Pairability.                              */
            
            /* Attempt to set the attached device to be pairable.       */
            Result = GAP_LE_Set_Pairability_Mode(BluetoothStackID, lpmPairableMode);
            
            /* Next, check the return value of the GAP Set Pairability  */
            /* mode command for successful execution.                   */
            if(!Result)
            {
              /* The device has been set to pairable mode, now register*/
              /* an Authentication Callback to handle the              */
              /* Authentication events if required.                    */
              Result = GAP_LE_Register_Remote_Authentication(BluetoothStackID, GAP_LE_Event_Callback, (unsigned long)0);
              
              /* Next, check the return value of the GAP Register      */
              /* Remote Authentication command for successful          */
              /* execution.                                            */
              if(Result)
              {
                /* An error occurred while trying to execute this     */
                /* function.                                          */
                DisplayFunctionError("GAP_LE_Register_Remote_Authentication", Result);
                
                ret_val = Result;
              }
            }
            else
            {
              /* An error occurred while trying to make the device     */
              /* pairable.                                             */
              DisplayFunctionError("GAP_LE_Set_Pairability_Mode", Result);
              
              ret_val = Result;
            }
          }
    #if 0
          else
          {
            /* An error occurred while trying to execute this function. */
            DisplayFunctionError("GAP_Register_Remote_Authentication", Result);
            
            ret_val = Result;
          }
    #endif
          //#ifdef __TAM__                           
        }
        //#endif
    #if 0
        else
        {
          /* An error occurred while trying to make the device pairable. */
          DisplayFunctionError("GAP_Set_Pairability_Mode", Result);
          
          ret_val = Result;
        }
    #endif
      }
      else
      {
        /* No valid Bluetooth Stack ID exists.                            */
        ret_val = INVALID_STACK_ID_ERROR;
      }
      
      return(ret_val);
    }
    
    

  • Peter,

    With the SW changes mentioned above and enabling the HCILL in the MainThread(), that covers everything on the software side to match the Mode mentioned in the datasheet.

    Please make sure that you are measuring the current on the VDD_IN of the CC256x and not on the entire board/module. I would also recommend making sure with a TI module like CC2564MODN that the HW differences in the module are not the responsible factor.

    Best regards,
    Vihang