cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723 using DMA method to implement timer input capture can only be executed once?

xiefengtian
Associate

Purpose: We would like to implement timer input capture in DMA mode on STM32H723 platform without interruption.
Current Problem: Use Cube MX to configure relevant parameters, only use CH2 of TIM4 as the direct mode for input capture, select Reset Mode for Slave Mode, select TI2FP2 as the trigger source, and then generate the corresponding code.
The frequency measurement works, but only once, if the external input frequency decreases from 1000Hz to 500Hz, it can only reset the programme to run at full speed again to measure 500Hz again, otherwise it will always be 1000Hz. not sure what the problem is? I suspect the trigger source may not be configured correctly? Or do you have to switch on both CH1 and CH2 channels, one directly and one indirectly? Please refer to the attached file for the configuration.
Any guidance would be greatly appreciated!

 

*This post has been translated from Chinese to comply with the ST Community guidelines.

 

 

2 REPLIES 2
Sarra.S
ST Employee

Hello @xiefengtian, welcome to the ST Community,

I can’t see how you handle the DMA transfer complete interrupt from your shared code. 

PS: we would find it much easier to include your code with </> rather than some snapshots in a doc file. 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

xiefengtian_0-1732797999414.png

xiefengtian_1-1732798015040.pngxiefengtian_2-1732798025775.pngxiefengtian_3-1732798040801.pngxiefengtian_4-1732798049539.pngxiefengtian_5-1732798058470.pngxiefengtian_6-1732798071950.png

以下是您测试的内容:
时钟为 120MHZ,分频器为 12,因此时钟为 10 000 000 HZ
外部输入频率为 500HZ
10 000 000/20000=500 赫兹
仿真显示数据是正确的,但只能执行一次,如果外部频率发生变化,则必须单击 reset 以更新 CCR2 寄存器

我没有使用中断,我知道从模式是开启的,并且选择了 reset 模式来自动收集 CCR2 值,我只需要去相应的地方计算频率。你的意思是我必须使用中断来避免他只执行一次吗?