Page 1 of 1
Triggering ADC with PWM timer
Posted: Mon Mar 06, 2017 5:08 am
by HDKLog
Hello,
I use PWM driver in my application and want to trigger ADC with it on falling edges. How can I accomplished this ?
PWM driver in mcuconf.h use TIM1 but I cant figure out which CCR it use and how to configure ADC CR2 to start conversion.
Re: Triggering ADC with PWM timer
Posted: Mon Mar 06, 2017 8:29 am
by Giovanni
Hi,
This matter should be covered in the STM32 Reference Manual, could you make more specific questions?
Giovanni
Re: Triggering ADC with PWM timer
Posted: Mon Mar 06, 2017 10:48 am
by HDKLog
Thank you for quick response Giovanni.
I just found in ADC Registers how to setup ADC to be triggered with timer event just don't know much details about PWM Driver and how it use TIM1 and which CC event I should use to trigger ADC. In mcuconf.h I have STM32_PWM_USE_TIM1 set to TRUE and I use channels 0-2 to output PWM but cant figure out which event of TIM1 I should use. I have 3 available options CC1, CC2 and CC3.
Re: Triggering ADC with PWM timer
Posted: Mon Mar 06, 2017 11:14 am
by Giovanni
The PWM driver uses comparators for operation, so it is the compare events.
giovanni
Re: Triggering ADC with PWM timer
Posted: Wed Mar 08, 2017 7:10 pm
by HDKLog
Thanks for reply Giovanni.
I am trying to figure out how PWM driver work... Does each channel of PWM driver tigerring with different cooperators ?
Re: Triggering ADC with PWM timer
Posted: Wed Mar 08, 2017 8:06 pm
by Giovanni
Correct, each channel is physically implemented using a comparator. Use the ADC trigger associated to the comparator used by your PWM channel.
Giovanni