2022-12-01 03:00 PM
I am following an the example from MOOC;
https://www.youtube.com/watch?v=nSLN_WM2TOc&list=PLnMKNibPkDnExrAsDpjjF1PsvtoAIBquX&index=59&t=889s
I can't make it work, apparently LPTIM trigger interrupts continuously.
I create a fresh project to reproduce problem.
I tested two case, as you can see on code down below.
Case 1 works fine and blink the led in a predictable frequency
Case 2 doesn't works, MOOCs example fashion, led blink at high frequency, but the video works fine, what is wrong ? some one can reproduce example as in MOOC? it is a bug was introduced on later version of something? or I am doing something bad?
HAL_LPTIM_TimeOut_Start_IT(&hlptim1, 0xffff, 0); // case 1, works
while (1)
{
//HAL_LPTIM_TimeOut_Start_IT(&hlptim1, 0xffff, 0); //case 2, doesn't work
while(flag_lptim);
// HAL_LPTIM_TimeOut_Stop_IT(&hlptim1); //case 2, doesn't work
flag_lptim = 1;
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE BEGIN 4 */
void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim)
{
flag_lptim = 0;
}