cancel
Showing results for 
Search instead for 
Did you mean: 

Any Highest frequency limitation for LPTIM, STM32L476 ?

rumlyen
Associate II
Posted on May 16, 2016 at 04:05

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);

}
1 REPLY 1
Posted on May 16, 2016 at 08:56

There might be some gotcha in the setup. I'd try internal clock and external counter input (LPTIMx_CFGR.CKSEL = 0, LPTIMx_CFGR.COUNTMODE = 1); of course no filter no prescaler etc. Also, please post registers content to avoid any library involvement.

Nevertheless... I can find no relevant LPTIM data in the current rev4 'L476 datasheet, nor in the current rev4 'F745 datasheet. This very question has been asked at the ST seminar I attended last December, after having been told that as an asynchronous timer it would run up high regardless of the internal clock; and the support could not come up with definitive answer either.

Sorry, but this is a shame, ST.

A good place to come up with relevant information would be the promised renewed Technical Journal...

JW