AnsweredAssumed Answered

Any Highest frequency limitation for LPTIM, STM32L476 ?

Question asked by Lyen.Rum on May 16, 2016
Latest reply on May 16, 2016 by waclawek.jan
Hello all,

I want to configure LPTIM_1 for an external pulse count application (~10MHz signal). I request to know whether any highest frequency limit? For signals more than ~200KHz, its giving 0 count. Less than 200KHz seems ok.

I've connected a square wave input (PB5 pin Nucleo) and configured as both LPTIM_1 external clock and external counter input (using Low Level Cube Library). I'm logging LPTIM_1 count value in every 5ms (LPTIM_2 interrupt) using UART and calculating the difference for exact count values.

Am I missing anything in LPTIM_1 configuration? I request your kind suggestion.

void Configure_LPTIMCounter1(void)
{
  LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
  LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_5, LL_GPIO_MODE_ALTERNATE);
  LL_GPIO_SetPinPull(GPIOB, LL_GPIO_PIN_5, LL_GPIO_PULL_DOWN);
  LL_GPIO_SetPinSpeed(GPIOB, LL_GPIO_PIN_5,LL_GPIO_SPEED_FREQ_VERY_HIGH);
  LL_GPIO_SetAFPin_0_7(GPIOB, LL_GPIO_PIN_5, LL_GPIO_AF_1);
 
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPTIM1);
  LL_LPTIM_SetClockSource(LPTIM1, LL_LPTIM_CLK_SOURCE_EXTERNAL);
  LL_LPTIM_SetCounterMode(LPTIM1,    LL_LPTIM_COUNTER_MODE_EXTERNAL);
  LL_LPTIM_SetUpdateMode(LPTIM1, LL_LPTIM_UPDATE_MODE_IMMEDIATE);
 
  LL_LPTIM_Enable(LPTIM1);
  LL_LPTIM_SetAutoReload(LPTIM1, 0xFFFF);
  LL_LPTIM_StartCounter(LPTIM1, LL_LPTIM_OPERATING_MODE_CONTINUOUS);
}

Outcomes