0
Follow
0
View

How to implement external pulse statistics based on Linux embedded system

dillboy 注册会员
2023-02-25 02:18

If the pulse frequency is very low, the precision is not high, you can query the IO status in a loop
If the frequency is high, the precision is also high, it needs the corresponding hardware system, Write the function to the device driver, through the device driver to achieve measurement.

xye20070408 注册会员
2023-02-25 02:18

Modulation based on Monster group and GPT:
External pulse statistics with GPIO(General Purpose Input/Output) pins. GPIO is a general-purpose I/O interface that can be configured for input or output operations.
See the steps:

  1. Find the GPIO pins supported by the system and the corresponding device node. You can view the Device Tree file or run ls /sys/class/gpio on the terminal to view the file.
  1. initializes and configures the GPIO pins you want to use to enable input operations. This usually requires the use of API functions provided by Linux's GPIO subsystem, such as gpio_request(), gpio_direction_input(), and so on.
  1. Use hardware modules such as counters or timers to count or measure input pulses. The counter or Timer usually needs to be configured using the system's timer device(such as timer, PWM, etc.) so that it can be associated with the GPIO pins.
  1. In the application program that needs statistical pulse information, the value of the counter or timer is read and processed accordingly.

About the Author

Question Info

Publish Time
2023-02-25 02:18
Update Time
2023-02-25 02:18