2022-04-20 07:23 AM
Hi,
I want to confim the pulse duration fo the TIM1 TRGO2 compare pulse. I used the TIM1 trgo2 to trigger the ADC. The TIM1 clock is 64MHz and the ADC clock is 32MHz, the sampling time is 7.5 ADC clock.
I want to set the ADC trigger mode is "01", but in the software I config the ADC trigger mode is ‘11:Hardware trigger detection on both the rising and falling edges’.
The result of my tests is that the pulse only triggers the ADC once on the rising edge.. The falling edge did not trigger the ADC converter. So the '11' is same with the '01:Hardware trigger detection on the rising edge '.
Is the pulse width of the TRGO2 only one clock cycle of the TIM1? If I want to trigger the ADC on the rising edge, is it ok if I use the "11" instead of "01"?
I'm using STM32G031 and STM32F301. The results are the same for both models.
I did not get the information from the user manual or other datasheet.
Thanks and best regards.
John
Solved! Go to Solution.
2022-04-20 09:15 AM
The trigger "pulse" is likely one clock cycle wide - either timer clock cycle or bus clock cycle. [EDIT: i.e. the trigger is "high" only as long as the "compare" is true]. Either way, there is no way the ADC can respond to both edges.
2022-04-20 09:15 AM
The trigger "pulse" is likely one clock cycle wide - either timer clock cycle or bus clock cycle. [EDIT: i.e. the trigger is "high" only as long as the "compare" is true]. Either way, there is no way the ADC can respond to both edges.
2022-04-20 10:58 AM
On a larger chip like F303 with 2 ADCs you can trigger 1st by the rising edge, and 2nd by the falling edge and measure the TRGO2 pulse width by polling end of conversion flags.
hth
KnarfB
2022-04-28 06:07 AM
The information is helpful. Thanks for you help.
2022-04-28 06:07 AM
Thanks for you help.