cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407IET Timer Gated Mode

Jm3
Associate II

Hello, 

I am using the STM32F407IET in one of my projects and I have timer 1 set us as follows below 

Jm3_0-1743517295652.png

Jm3_1-1743517313084.png

Jm3_2-1743517350952.png

currently my channel 1 is used to record the positive rises on a incoming pulse signal and what I want to do is use the gated mode to be able to tell me when the pulse is high this way I should be able to calculate duty cycle. the issue that I am currently facing is the gated count can elapse before my DMA interrupt flags so I'm struggling to measure anything with over ~5% duty cycle. is there a way on this timer to throw an interrupt when the count has elapsed? 

for example I have another timer set up to so when the count reaches the end of its counting period it throws an interrupt so I can set a bunch of flags every second and that's using the global interrupt but for some reason timer 1 doesn't have a global interrupt and I don't know how to make it interrupt from the timer. 

if you need any more information please let me know and hopefully that makes sense. 

Thank you

 

7 REPLIES 7

I have no idea whatsoever what do you want to achieve. Try to draw a timing diagram.

JW

All I want to be able to do is have an interrupt when the count on timer 1 elapses?

If you want interrupt when TIMx_CNT reaches TIMx_ARR, that's Update event, so what you want is Update interrupt.

JW

Jm3
Associate II

Yes that's what I thought, so for my configuration now I have my TIM1_ARR set to 65535 and the NVIC TIM1 Update enabled 

Jm3_0-1743760781246.png

Jm3_1-1743760795982.png

I assumed then that once TIM1_CNT reached TIM1_ARR it would trigger a interrupt so I went into the interrupt code and put a breakpoint here

Jm3_2-1743761120814.png

but it never stops on it even though it will stop on other interrupts. 

I'm not sure if maybe I have my configuration wrong but I'm just confused as to why its not triggering. 

Thank you

Well, I don't know. I don't use Cube/CubeMX/CubeHAL, and all I can offer is a "interrupt-doesn't-fire" checklist, but that expects register-level debugging.

JW

Jm3
Associate II

Thank you for your help, I relalised I was not initializing the timer 1 interrupt.