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.
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.
Does the behaviour of the comparator change in up-down mode?
A CCx Trigger should occur when CNT==CCRx
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?)
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.
Retrieving data ...