LPTIM with RepetitionCounter dosnt work
Hello,
I need counter which should wakeup system from stop2 mode at every sequential time.
So currently use below setting and it works fine and wakeup at every ~4.16 minutes. But I want it should wakeup at max time of 30minutes (not fixed but looking for max time it can achieve). So thinking to use Repetition counter so that it can repeat the same counter and once repeat counter complete it will wakeup the system. But it's not affecting with repetition counter value. works same at zero.
void MX_LPTIM1_Init(void)
{
LPTIM_OC_ConfigTypeDef sConfig1 = {0};
// 1. Enable LSI Clock
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
// 2. Select LSI as LPTIM1 clock source
__HAL_RCC_LPTIM1_CONFIG(RCC_LPTIM1CLKSOURCE_LSI);
// 3. Enable LPTIM1 clock
__HAL_RCC_LPTIM1_CLK_ENABLE();
// 4. Configure LPTIM1
hlptim1.Instance = LPTIM1;
hlptim1.Init.Clock.Source = LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC; // This is overridden by RCC config
hlptim1.Init.Clock.Prescaler = LPTIM_PRESCALER_DIV128;
hlptim1.Init.Trigger.Source = LPTIM_TRIGSOURCE_SOFTWARE;
hlptim1.Init.Period = 65535;//63999;
hlptim1.Init.UpdateMode = LPTIM_UPDATE_IMMEDIATE;
hlptim1.Init.CounterSource = LPTIM_COUNTERSOURCE_INTERNAL;
hlptim1.Init.Input1Source = LPTIM_INPUT1SOURCE_GPIO;
hlptim1.Init.Input2Source = LPTIM_INPUT2SOURCE_GPIO;
hlptim1.Init.RepetitionCounter = 0;
if (HAL_LPTIM_Init(&hlptim1) != HAL_OK)
{
Error_Handler();
}
// 5. Configure Output Compare (optional, if needed)
sConfig1.Pulse = 65535;//63999;
sConfig1.OCPolarity = LPTIM_OCPOLARITY_HIGH;
if (HAL_LPTIM_OC_ConfigChannel(&hlptim1, &sConfig1, LPTIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
// 6. Start LPTIM in interrupt mode
if (HAL_LPTIM_Counter_Start_IT(&hlptim1) != HAL_OK)
{
Error_Handler();
}
//Priority(LPTIM1_IRQn, 0, 0);
//HAL_NVIC_EnableIRQ(LPTIM1_IRQn);
}I just want to know does it support this feature, if yes then what I'm missing.
Also suggest me the callback which expect to call after the completion of the repetition counter.
Currently testing it just blinking led after stop2 wakeup statement.
Thanks,
Nitin
