Input filtering mechanism of stm32 Timer

Source: Internet
Author: User

The timer input channel of stm32 has a filter unit, which is located on each input path (yellow box in the middle) and the External Trigger input path (blue box in the middle ), they are used to filter out high-frequency interference from input signals.


The procedure is as follows:

CKD [1:0] In timx_cr1 allows you to set a sampling frequency benchmark for the input signal. There are three options:
1) sampling frequency reference fdts = timer input frequency fck_int
2) sampling frequency reference fdts = timer input frequency fck_int/2
3) sampling frequency reference fdts = timer input frequency fck_int/4

Then, the above frequency is used as the benchmark to sample the input signal. When n valid electric signals are continuously sampled, a valid input level is considered.

The actual sampling frequency and number of sampling times can be selected by the user program as needed; the filter parameters of the external triggering input channel are set in the ETF [] of the slave mode control register (timx_smcr; filter parameters for each input channel in capture/compare mode register 1 (timx_ccmr1) or capture/compare mode register 2 (timx_ccmr2) ic1f [], ic2f [], ic3f [], and ic4f.


For example, when fck_int = 72mhz, select fdts = fck_int/2 = 36 MHz, sampling frequency fsampling = fdts/2 = 18 MHz and n = 6, the signal above 3 MHz will be filtered out by this filter, effectively shielding interference above 3 MHz.



For example, in combination with the interruption of input capture, you can easily achieve the de-jitter function of keys without the intervention of software. This is a de-jitter function implemented by hardware, this greatly saves software overhead and program code length.

Each timer can input up to four buttons. This method can also be used for keyboard matrix scanning. In addition, the software does not need to scan frequently because it is implemented through interruption.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.