cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble catching overflow interrupt (Period Elapsed) on TIM3 while doing input capture

HForr.1
Associate II

I'm using STM32CubeMX and HAL functions.

I've gotten interrupt capture working for Timer 3 Channel 3. However, my input frequency is low and the 16-bit capture value is overflowing multiple times. I've solved this many times in the past with a different manufacturer microcontroller, so I know what to do. I'm trying to capture an interrupt for when Timer 3 itself overflow, so that I can count those overflows and thus logically extend the 16-bit capture value.

HOWEVER, I can't seem to catch the overflow interrupt (Period Elapsed). I do find that there's pretty much ZERO comprehensive doc for how all the HAL functions work. So I find myself poking around at many examples, and looking inside HAL code, trying to figure out what to do. It's just not working.

Please note that my main function has a definition of HAL_TIM_PeriodElapsedCallback() that was put there by the Cube and includes an "if(htim->Instance == TIM1) HAL_IncTick();". So I tried adding an "if(htim->Instance == TIM3) CallMyIncrement();" but CallMyIncrement() seems to never be called.

I have an early call to HAL_TIM_IC_Start_IT(&htim3, TIM_CHANNEL_3) to configure the input capture, just because an example did this. I also have NVIC Settings TIM3 global interrupt enabled in the Cube. I've had those since the beginning, and the input capture has worked since the beginning. But not the overflow (period elapsed) interrupt. I tried adding a call to HAL_TIM_Base_Init(&htim3); and HAL_TIM_Base_Start(&htim3); but that doesn't help.

CAN I IN FACT GET TWO TYPES OF INTERRUPTS out of Timer 3? I need both the input capture interrupt and the overflow (period elapsed) interrupt.

Another thing, the Cube for TIM3 has a config for "Clock Source" that is currently "Disable". No clue what that does. I could joke about how does this timer work if it has a clock source. Changing this to Internal, without perhaps doing some other magic, didn't help my overflow interrupts either.

Help!!!! Thanks very much.

23 REPLIES 23
HForr.1
Associate II

Thanks again, @Community member​ .

Hey, where is that "peripheral view" you wrote about? Is it in Atollic TRUEStudio or is it in the ST IDE? I couldn't find it in Atollic TRUEStudio, which is what I'm using.

> Hey, where is that "peripheral view" you wrote about?

I did not write about "peripheral view" and I don't use either of those IDE.

Btw. Atollic is out of business, it was bought by ST, and that's how CubeIDE came to be. Both are eclipsoids, so I guess "peripheral view + eclipse" are good keywords to google.

JW

HForr.1
Associate II

oh, @gbm​ , where is that "peripheral view" you wrote about. Is it in Atollic TRUEStudio or is it in the ST IDE? I couldn't find it in Atollic TRUEStudio, which is what I'm using.

And @Community member​ , yep I generally dislike eclipse. It's often a bit funky, although the Atollic (now owned by ST) version isn't too bad. But it's the widest known free platform, so there you go! I like that term "eclipsoid", LOL.

Piranha
Chief II