timer DMA GPIO input capture with constant frequency
- May 9, 2018
- 14 replies
- 3986 views
Hello! I need to capture signals on inputs with constant frequency for further investigation. I use the following scheme: set timer frequency needed with update DMA request and capture size for DMA, then get data from input pins via DMA. The capture itself works. The problem is DMA capture inaccuracy, it seems DMA capture frequency floats and is not constant which results in input signal wrong capture. For exapmle, timer update frequency (capture frequency) is 100 kHz, input is10 kHz PWM signal with 50 % duty cycle; capture is 10,5 kHz PWM with 40 % - 55 % duty cycle. The more capturing frequency, the more capture inaccuracy. If timer update frequency is 1 MHz, input is10 kHz PWM signal with 50 % duty cycle; capture is 10,5 - 12,3 kHz PWM with 40 % - 55 % duty cycle. Please, see attached picture. I tried to sleep CPU while capturing, the result is the same.
What could be done to make capturing precise and stable?
#timer-update-dma-gpio Note: this post was migrated and contained many threaded conversations, some content may be missing.