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.

CC2541: Active and disactive Power Saving on SimpleBLEPeripherial example

Part Number: CC2541

I have tried to perform a Simple Peripherial example with power saving but it has a big comsumption (around 6mA) I have enabled POWER_SAVING definition on preprocessor option. but it still doesn't work.

In general I what to use UART just with RX and TX wire. I have seen that this is imposible to do with POWER_SAVING but I have a personal way to make it. I have this function:

static void BlueWave_ChangeState(void)
{
  bool Advertising_Enable;
  uint8 new_state;
  osal_stop_timerEx( timerBluetooth_TaskID, CHANGE_STATE_EVT );
  GAPRole_GetParameter(GAPROLE_STATE, &new_state);
  switch(new_state)
  {
  case GAPROLE_ADVERTISING:
  {
  Advertising_Enable = FALSE;
  sleepModecount++;
  if(sleepModecount == MAX_COUNT_ADV)
  {
  sleepModecount = 0;
  GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &Advertising_Enable );
  osal_start_timerEx( timerBluetooth_TaskID, CHANGE_STATE_EVT, WAITING_LONG_PERIOD );
  halSleep(WAITING_LONG_PERIOD-1);
  break;
  }
  else
  {
  GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &Advertising_Enable );
  osal_start_timerEx( timerBluetooth_TaskID, CHANGE_STATE_EVT, WAITING_PERIOD );
  halSleep(WAITING_PERIOD-1);
  break;
  }
  }
  break;
  case GAPROLE_WAITING:
  {
  Advertising_Enable = TRUE;
  GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &Advertising_Enable );
  osal_start_timerEx( timerBluetooth_TaskID, CHANGE_STATE_EVT, ADVERTISING_PERIOD );
  }
  break;
  }
}

How you can see. I use halSleep function. It works very well if I active the just 135 ms adv and then put the MCU in sleep mode once(MAX_COUNT_ADV) but when this is diferent it doesn't works 

WAITING_LONG_PERIOD = 4000 ms

WAITING_PERIOD = 800 ms

ADVERTISING_PERIOD = 135 ms

I have though that UART could work making this: while advertising 

osal_pwrmgr_device( PWRMGR_BATTERY );

then when connected

osal_pwrmgr_device( PWRMGR_ALWAYS_ON );

which is when I need UART comunicaion. but I can't perform Power Saving with empty project.

When I use my own metod the batery live go around 8 mounths but I need 1 year

Please could you help me? Im really stock on this project.