I have tried to configure a trigger generator at the beginning of PWM period. I was able to setup with this way:
- PWM Master BUS: MCB_UP_DOWN_COUNTER.
- EMIOS CHANNEL: COUNTER BUS A.
- Some channels configured as OPWMCB to generate PWM with center aligned.
- One channel configured as OPWMB to generate trigger in BCTU.
- BCTU triggering the ADC conversion.
So I had this result:
We can see in this last print, the delay P0 - time from start of PWM period until start of ADC conversion - around 1.466us.
Why is 1.466us? I couldn't remove this delay. Do I need to use other mode of PWM to generate this trigger?
Note: "ADC Conversion" channel shows the start of trigger (rising edge) and the end of conversion (falling edge).
Thanks.
Hi,
how is a "ADC Conversion" signal generated? Is it GPIO toggling in some place of code? OPWMB flag represents BCTU trigger so can you move ADC conversion over PWM period?
BR, Petr
Hello @PetrS ,
I have tested it with these two notifications:
Configured as:
And:
And yes, I can move the ADC conversion over PWM period, if I change, the trigger change as well.
Follow my code for your review, maybe there is something wrong...
Thanks.
Hi,
most probably it will be due to SW overhead. You are toggling pin within callbacks, so there could be significant delay, depends on driver. You can try to place toggling on first instruction of BCTU interrupt, then you should get closer to PWM edge. Moreover measure delay from the edge, where flag (trigger) is generated.
BR, Petr
Hello @PetrS ,
Yes, it make sense for me... So probably the trigger is over PWM period, but we are facing SW overhead...
Thanks for help!