cancel
Showing results for 
Search instead for 
Did you mean: 

Why the value of HAL_TIM_ReadCapturedValue lower after LPM enabled

Charles_Li
Associate II

 

 

  case PWR_KEY_Pin:
    if (HAL_GPIO_ReadPin(PWR_KEY_GPIO_Port, PWR_KEY_Pin) == GPIO_PIN_RESET)
    {
      HAL_TIM_IC_Start_IT(&htim16, TIM_CHANNEL_1);
      captureStart = HAL_TIM_ReadCapturedValue(&htim16, TIM_CHANNEL_1);
      UTIL_LPM_SetStopMode(1 << CFG_LPM_HTIM16, UTIL_LPM_DISABLE);
    }
    else
    {
      HAL_TIM_IC_Stop_IT(&htim16, TIM_CHANNEL_1);
      captureEnd = HAL_TIM_ReadCapturedValue(&htim16, TIM_CHANNEL_1);
      pressDuration = captureEnd - captureStart;
      UTIL_LPM_SetStopMode(1 << CFG_LPM_HTIM16, UTIL_LPM_ENABLE);

 

 

After LPM enabled

 

#define CFG_LPM_SUPPORTED    1

 

 

Long press the button for 5 secs, pressDuration will output ~2000 only.

The application was base on BLE_p2pServer and I'm sure PWR_EnterStopMode was not called by add "UTIL_LPM_SetStopMode(1 << CFG_LPM_HTIM16, UTIL_LPM_DISABLE);" 

 

 

0 REPLIES 0