in two places. Also - what range of frequencies are you trying to measure? Waiting for a printf after the first capture compare will limit your upper frequency. Cheers, Hal
The program may have locked out the interrupt. You enabled an interrupt, but as far as I can tell here, you did not clear the interrupt in an IRQ handler. See the vectors.c file int the STM library TIM examples for IRQ handler programming. The IRQ handler is a good place to read the capture register, since the interrupt has just occurred. Your main.c can then printf without disturbing the capture timing. Cheers, Hal
STM has provided an example that does what you are trying to do. Go to the STM32 Downloads section and make the following selections:
Downloads Documents and Files Firmware STM32F10x_StdPeriph_Lib Download the library to your computer, and then make the following selections in the library directories: Project STMF10xStdPeriph_Examples TIM Input Capture main.c and stm32f10x_it.c main.c sets up the clocks, NVIC, timer interrupts, etc., then goes into an idle mode. stm32f10x_it.c contains the IRQ handler which services the interrupt, then computes the frequency. If you wish to print out the frequency at some interval, you should add that to main.c as I stated in an earlier post. This should get you going. A votre sante ! Hal
Hello Cheers Hal, thank you very much for your help.
I did not understand what to do with IRQ handler sorry but this is the first time I make this type of programming and not the ST is helping me.
You think that there can be blocked interrupt? Stm32f10x_stdperiph_lib From the examples I see this call enables interrupts by ''TIM_ITConfig (TIM3, TIM_IT_CC2, ENABLE);'' and then configure the nvic through this function call
I do not know what to do, I'm going crazy the brain.
Do not have a working code sample so I can understand how and what to do?? I searched throughout the forum but have not found anything that can help me.
Your interrupt handler name is different from the standard peripheral library example. Perhaps your development environment TIM interrupt vector is pointing to a different interrupt handler.
I am guessing because I can't see how you have put together your program in your development environment.
Look at an example such as ''Hello'' provided with your environment. It probably has another file such as vectors.c with all the interrupt handlers. The unused handlers will simply halt on interrupt. And, there should be a start up file that initializes all the interrupt vectors to call the handlers. You need both of these files (or something equivalent) in your program. Then you modify the TIM3 IRQ Handler to service the interrupt and calculate the frequency. If this is still a puzzle to you, find someone experienced who can look at your program for errors. Cheers, Hal