cancel
Showing results for 
Search instead for 
Did you mean: 

HAL bug in LPTIM interrupt.

Andres Cao
Associate III
Posted on November 27, 2017 at 14:20

Hi everyone,

I'm trying to clear my head around interrupts with an STM32l0x3. I'm not using HAL functions, rather I'm trying to understand the logic behind all this.

This becomes a little bit messier since the NVIC registers are not described in the Reference Manual, but in the Programming Manual. 

Anyway, working on this I found that for the EXTI the reference manual says:

For the direct interrupt lines: the interrupt is enabled by default in the interrupt mask register and there is no corresponding pending bit in the pending register.

The LPTIM interrupt is a direct line, hence this text applies.  LPTIM is interrupt number 29. 

0690X00000608xyQAA.png

PIF29 doesn't exist, and bit 23:31 should be kept at reset value as stated.

However, at the end of  ''HAL_LPTIM_IRQHandler(&hlptim1);'' we can find  ''__HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG();''

This macro translates to ''EXTI->PR = LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT''

and #define LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_IM29)

So, this means that EXTI_PR 29th bit is being set to 1. First of all, as I understand, this has no effect at all. Second, it goes against the reference manual.

Is my understanding correct?

Cheers,

Andrés

2 REPLIES 2
Amel NASRI
ST Employee
Posted on November 30, 2017 at 14:59

Hi

Cao.Diego_Andres

‌,

To clear up the ambiguity, I confirm that the RM0367 is correct.

I raised internally the error you highlighted regarding the definition of both macros '__HAL_LPTIM_WAKEUPTIMER_EXTI_GET_FLAG' and '__HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG' where EXTI_PR is wrongly used.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Amel NASRI
ST Employee

Hello,

Please note that the raised error was fixed in STM32CubeL0 V1.11.0.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.