Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 4 months ago.
Sample Code for Measure frequency upto 10MHZ in MBED Nucleus Board (STM32F104)
Sample Code for Measure frequency upto 10MHZ in MBED Nucleus Board (STM32F104) for timer 2 channel 3....?
2 Answers
6 years, 4 months ago.
Please refer my notebook.
/users/kenjiArai/notebook/frequency-counters/
/users/kenjiArai/notebook/simple-frequency-counter/
I don't know STM32F104F but I hope you can use similar configuration for your CPU.
6 years, 4 months ago.
Did you mean STM32F401? This is usually called pulse counting or maybe frequency counting. That micro has an 84MHz clock so 10MHz is a screaming fast signal to try to measure. Basically impossible to do this in software. This has to be offloaded to hardware. The best way I can think of is to configure a timer to work with an external clock input. This external 10MHz signal then clocks your timer and software can check the accumulated timer value periodically at a fixed time interval. Of course only works if the micro timer hardware supports external clock input - it appears timers on this micro do support this. This requires that you dig down into the ST HAL layers.
You can also check the STM forums, I'm sure there are some examples of setting this up in HAL. I don't immediately see anything from the mbed import wizard that fits the bill here. And of course read the HAL libraries, they may even have a function to help setup timers in this mode.