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 II

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

已经找到原因,是因为此GPIO作为普通io再另外地方初始化了

Translation:

The reason has been found, because this GPIO is initialized as a normal IO in another place

View solution in original post

4 REPLIES 4
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 值,我只需要去相应的地方计算频率。你的意思是我必须使用中断来避免他只执行一次吗?

Translation:

Here is what you tested:
The clock is 120MHZ, the divider is 12, so the clock is 10 000 000 HZ
The external input frequency is 500HZ
10 000 000/20000=500 Hz
The simulation shows that the data is correct, but it can only be executed once. If the external frequency changes, you must click reset to update the CCR2 register

I am not using interrupts. I know that the slave mode is on and the reset mode is selected to automatically collect the CCR2 value. I just need to go to the corresponding place to calculate the frequency. Do you mean that I must use interrupts to avoid him only executing once?

 

已经找到原因,是因为此GPIO作为普通io再另外地方初始化了

Translation:

The reason has been found, because this GPIO is initialized as a normal IO in another place

Hello @xiefengtian ,

In next time, please kindly use English language. I've edited your post to translate your text.

Thank your for your understanding.

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.