Triggering ADC with PWM timer Topic is solved

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
HDKLog
Posts: 45
Joined: Thu Aug 18, 2016 12:36 am
Has thanked: 1 time
Been thanked: 3 times

Triggering ADC with PWM timer

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Triggering ADC with PWM timer

Post by Giovanni »

Hi,

This matter should be covered in the STM32 Reference Manual, could you make more specific questions?

Giovanni
User avatar
HDKLog
Posts: 45
Joined: Thu Aug 18, 2016 12:36 am
Has thanked: 1 time
Been thanked: 3 times

Re: Triggering ADC with PWM timer

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Triggering ADC with PWM timer

Post by Giovanni »

The PWM driver uses comparators for operation, so it is the compare events.

giovanni
User avatar
HDKLog
Posts: 45
Joined: Thu Aug 18, 2016 12:36 am
Has thanked: 1 time
Been thanked: 3 times

Re: Triggering ADC with PWM timer

Post 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 ?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Triggering ADC with PWM timer

Post 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
Post Reply