This question has been asked but there is not workable solution to it. Therefore, I need to ask it again:
I am developing my own application based on the Keyfob-demo project. It is expected that the keyfob (peripheral) is supposed to measure the RSSI between the master and itself after a given period of sampling time. During the sampling time, the keyfob should go into sleep ( power mode 1 is sufficient but if it can go into the power mode 2, it would be better). I have the following codes for the rssi sampling section ( it was in a event handling process. The flag value for this event is KFD_RSSI_READ_EVT_T):
.....
rssi_sampling_counter = 0;
uint16 simpleBLEConnHandle;
//halSleep(10);
GAPRole_GetParameter(GAPROLE_CONNHANDLE,&simpleBLEConnHandle);
HCI_ReadRssiCmd(simpleBLEConnHandle );
#if defined ( POWER_SAVING )
osal_pwrmgr_device( PWRMGR_BATTERY );
#endif
osal_stop_timerEx( keyfobapp_TaskID, KFD_START_DEVICE_EVT);
osal_stop_timerEx( keyfobapp_TaskID,KFD_BATTERY_CHECK_EVT);
osal_stop_timerEx( keyfobapp_TaskID, KFD_ACCEL_READ_EVT);
osal_stop_timerEx( keyfobapp_TaskID, KFD_TOGGLE_BUZZER_EVT);
osal_stop_timerEx( keyfobapp_TaskID, KFD_ADV_IN_CONNECTION_EVT);
osal_stop_timerEx( keyfobapp_TaskID, KFD_PERIODIC_EVT);
osal_stop_timerEx( keyfobapp_TaskID, KFD_RSSI_READ_EVT_T);
osal_stop_timerEx( keyfobapp_TaskID, KFD_BUTTON_EVT);
halSleep(10);
osal_start_timerEx(keyfobapp_TaskID,KFD_RSSI_READ_EVT_T, rssi_sampling_period);
.....
I have tried to terminate all the timer evenst in the keyfob demo application layer except the rssi sampling one before it goes into sleep. However, there is still some peaks showing up in every 200 - 300 ms according to the oscilloscope graph. I read the past threads on this issue and some users suggested that the keyfob can only go to sleep where there is no active tasks on-hold. But in my case, the RSSI sampling timer cannot be stopped, right? Otherwise, how can the keyfob knows when to measure the rssi value? So does it mean the keyfob can never go into the power mode 1 in my case? I am deperately looking for help on this issue. Please advise and I will appreciate any constructive response to my urgent request. Thanks.