cancel
Showing results for 
Search instead for 
Did you mean: 

TIM7 time base config with hal lib is disabling interruption after few attended interruptions.

Posted on April 25, 2017 at 09:42

I configured TIM7 as time base timer using HAL_TIM libs as indicated in this post: 

https://community.st.com/0D50X00009XkYJ6SAN

At interruption callback I increase a counter var in order to get multiples of 100us timings for different tasks. But first I started trying and testing with toggle led every 500ms (I know is a low freq but i need to see it with my eyes). 

The fact is that when app runs in debug mode, it seems to start correctly: every 100 counts of cnt register one interruption is activated and counter increases unity. This ocurres until counter reaches once 11 or 12, but the number of the last attended interruption is about 12. After this, cnt counter runs and restarts correctly. But no interruption is activated, thread didn't pass to the irqhandler neither elapsedtimeinterruption callback.

Which could be the cause of this behavior?

Could be the cause on HAL library that is disabling updates or interruptions? 

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on April 27, 2017 at 15:05

I must say that I solved it. I was debugging and after 12 aprox interruptios pc counters went to unkown part. I put a breakpoint at while (1) and thread never passed throught that point. When stopped I can see that was in startup_stm32l476xx.s file at  SysTick_Handler line in a inifinit loop:

SysTick_Handler PROC

                              EXPORT SysTick_Handler [WEAK]

                              B          .

                              ENDP

I don't know exactly what is it. I know systick handler is a handler of 1ms ticks system clock for your system if you choose the systick as a source clock. But I didn't choose it. Anyways, as I see this tag: [WEAK] I started to think that it could be an user issue to implement this function or to declarate it, somewhere at user code. So, I don't understand too much why my system needs it, but it works. 

I put as I saw in other examples: 

void SysTick_Handler(void)

{

      HAL_IncTick();

}

at stm32l4xx_it.c file.

After this, there were no more lost pc counter neither no lost interruptions. 

View solution in original post

1 REPLY 1
Posted on April 27, 2017 at 15:05

I must say that I solved it. I was debugging and after 12 aprox interruptios pc counters went to unkown part. I put a breakpoint at while (1) and thread never passed throught that point. When stopped I can see that was in startup_stm32l476xx.s file at  SysTick_Handler line in a inifinit loop:

SysTick_Handler PROC

                              EXPORT SysTick_Handler [WEAK]

                              B          .

                              ENDP

I don't know exactly what is it. I know systick handler is a handler of 1ms ticks system clock for your system if you choose the systick as a source clock. But I didn't choose it. Anyways, as I see this tag: [WEAK] I started to think that it could be an user issue to implement this function or to declarate it, somewhere at user code. So, I don't understand too much why my system needs it, but it works. 

I put as I saw in other examples: 

void SysTick_Handler(void)

{

      HAL_IncTick();

}

at stm32l4xx_it.c file.

After this, there were no more lost pc counter neither no lost interruptions.