cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Timer to ADC trigger

Vivek Sankaranarayanan
Associate II
Posted on August 16, 2017 at 18:56

How can I trigger ADCs for injected conversion at CTR=PRD when my TIM8 is configured for up-down counting? I don't see any mechanism that can do this.

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on August 16, 2017 at 20:16

And what registers reflect CTR and PRD in your scenario?

If you are using CCR1 and CCR2 to control the TIM, then CCR3 or CCR4 would need to be programmed with the phase value you wish to trigger on. If the up-down nature of your configuration causes this to be sampled twice, then discard the one you're not interested in.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4
Posted on August 16, 2017 at 19:11

Does the behaviour of the comparator change in up-down mode?

A CCx Trigger should occur when CNT==CCRx

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Vivek Sankaranarayanan
Associate II
Posted on August 16, 2017 at 19:25

So my configuration is this:

- TIM8 is configured for up/down mode

- TIM8 CH1 generates a PWM to control one converter. CC1 will hold duty cycle for this PWM

- TIM8 CH2 generates complementary PWMs to control another converter. CC2 will hold duty cycle for these PWMs

- All generated PWMs are center aligned.

I need to trigger ADC conversions at exactly CTR=PRD since this is where I expect least ringing will occur for center-aligned PWMs. My plan is to connect OC3REF to TRGO2 signal to trigger ADCs. What mode do I configure OC3REF such that trigger pulses are generated at CTR=PRD? (Or do I even need OC3REF? Can the triggers at CTR=PRD be somehow generated using OC1/2REF?)

Posted on August 16, 2017 at 20:16

And what registers reflect CTR and PRD in your scenario?

If you are using CCR1 and CCR2 to control the TIM, then CCR3 or CCR4 would need to be programmed with the phase value you wish to trigger on. If the up-down nature of your configuration causes this to be sampled twice, then discard the one you're not interested in.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 16, 2017 at 20:30

I think I found a way.

I assign OC3REF as TRGO2 output. Then I let OC3REF toggle on CCR3 match.

The ADC will be configured for hardware trigger on both rising and falling edges.