Skip to main content
SWenn.1
Senior III
May 26, 2022
Solved

LPTIM1 STM32L476RG (nucleo)??

  • May 26, 2022
  • 2 replies
  • 708 views

I am trying to create a 50ms timer using the above reference. The clock is 16MHz, I have a divisor of 16 and have the NVIC enabled (all this is done in cubeMX). I have the following ISR

void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim)
{
	hlptim1.Instance->ISR |= (LPTIM_ICR_ARRMCF | LPTIM_ICR_CMPMCF);
}

Prior to the while 1 loop I call:

HAL_LPTIM_Counter_Start_IT(&hlptim1, 50000);

It doesn't appear to me to be working correctly.....At start up I get into the ISR and count is way less than it should be....Can someone tell me what I am doing wrong? This should be pretty simple as I just want the timer to count to 50ms (using 16mhz with /16) and every time it rolls generate an IRQ....

0693W00000NqjVUQAZ.png 

This topic has been closed for replies.
Best answer by SWenn.1

Turns out the timer was being clocked at some very slow rate as another FW person touched it ....This has been solved...Thank you

2 replies

waclawek.jan
Super User
May 27, 2022

> At start up I get into the ISR and count is way less than it should be....

Is LPTIM stopped upon breakpoint in its respective DBGMCU freeze register?

JW

SWenn.1
SWenn.1AuthorBest answer
Senior III
May 27, 2022

Turns out the timer was being clocked at some very slow rate as another FW person touched it ....This has been solved...Thank you