2021-05-28 12:56 AM
Hi,
Id need to measure the frequency of an input signal using TIM4. My device is a STM32L475RCT and to do this I've used the TIM_InputCapture example from CubeIDE. In my application TIM1 is not available.
The problem is for the TIM4 I'm not able to set the Input Capture Interrupt from NVIC Interrupt table. How can I do this?
I've also observed the TIM17 is available and I think this timer can be linked to TIM1 somehow. The Input Capture Interrupt for TIM1 is feasible.
Any idea?
regards,
gaston
Solved! Go to Solution.
2021-05-28 03:17 AM
Hello @Gaston ,
Thanks for your for having reporting.
Actually, backing to Nested vectored interrupt controller (NVIC) section in STM32L47xxx Reference Manual, only Timer 1 as well as Timer 8 are able to generate TIMx capture compare interrupt (x=1/8):
Also, you can find the different Interrupt Definition in the generated stm32l475xx.h file.
Thus, only TIM4 global interrupt can be enabled through STM32CubeMX.
>I've also observed the TIM17 is available and I think this timer can be linked to TIM1 somehow. The Input Capture Interrupt for TIM1 is feasible.
I'm not sure that I understood your request, but if you meant the "Timer Link feature for synchronization or event chaining" you can find more details in STM32L475xx Data Sheet. You can refer also to the STM32 cross-series timer overview for further information.
Hope this helps you.
Khouloud.
2021-05-28 03:17 AM
Hello @Gaston ,
Thanks for your for having reporting.
Actually, backing to Nested vectored interrupt controller (NVIC) section in STM32L47xxx Reference Manual, only Timer 1 as well as Timer 8 are able to generate TIMx capture compare interrupt (x=1/8):
Also, you can find the different Interrupt Definition in the generated stm32l475xx.h file.
Thus, only TIM4 global interrupt can be enabled through STM32CubeMX.
>I've also observed the TIM17 is available and I think this timer can be linked to TIM1 somehow. The Input Capture Interrupt for TIM1 is feasible.
I'm not sure that I understood your request, but if you meant the "Timer Link feature for synchronization or event chaining" you can find more details in STM32L475xx Data Sheet. You can refer also to the STM32 cross-series timer overview for further information.
Hope this helps you.
Khouloud.
2021-05-28 04:04 AM
Hi Khouloud,
Thank you for replying. Okay, there is not possible to use the Input Capture Interrupt but I have to measure the input signal frequency/period on PB7 pin (the Hardware is already made). CubeMx shows these available timers:
As we have seen I cannot use TIM4_CH2 with this purpose but I wonder if it is possible with TIM17, TIM8.
I've tried to set TIM8 but in this case I cannot select the Input Capture Direct mode for any channel. All of them are in conflict with others pins (Channel 1..4) or have only the Output available (Channel 5..6)
The only alternative I see is to use TIM17 but I don't know how. I'll check the information you've suggested but I'd appreciate any help from your side.
thanks in advance,
gaston
2021-05-28 06:21 AM
gaston,
> Okay, there is not possible to use the Input Capture Interrupt
Khouloud did not say that you cannot use interrupt upon Input Capture on TIM4, just that you have to enable the "global TIM4 interrupt" - it merges all the interrupt sources into a single interrupt vector. Then it's the task of the ISR to distinguish between the sources; Cube will do this for you if you use it.
JW
2021-05-28 07:06 AM
JW, thanks for the clarification.
regards,
gaston
2024-09-18 11:25 PM
hii how can i detect falling and rising edge suing input capture mode using interrupt?
2024-09-19 12:19 AM
Next time, don't hijack an old thread, start your own.
If the input signal is relatively slow (i.e. the edges are far apart in time), set interrupt to both edges and in the ISR distinguish between the two cases by reading the current GPIO Input level of given pin.
If there are potentially short pulses but relatively far apart, use two channels for capturing rising and falling edges separately, one of them capturing on the "neighbouring" pin.
For even faster input signals you cannot use interrupts and have to resort to DMA.
JW