2020-07-22 10:20 AM
This question has been asked in various forms before but I have not found an answer. I am using TIM2 to generate a center aligned PWM signal as shown in the image. I want to sample the ADC at the center of the PWM. I am using the TRGO signal of the timer to trigger the ADC. However, it seems that regardless of how I configure the TRGO, there are always two events triggered per PWM period instead of one. Is it possible somehow just to create one trigger event or do I need to chain another timer or switch to a more capable timer, e.g. TIM1?
2020-07-22 03:54 PM
Try TIMx_CR1.CMS=0b01 or 0b10 and TRGO selected as 0b011: Compare Pulse from CC1.
JW
2020-07-22 05:28 PM
For debug purpose, use another channel to generate the trigger signal and feed it to the ADC trigger input pin. Confirm the basic first, then try to use internal signaling.