Skip to main content
Explorer
November 23, 2023
Solved

Syncing ADC to PWM in center aligned mode for single event per period

  • November 23, 2023
  • 2 replies
  • 2831 views

I working on motor control application with stm32g484ret6.
Timer1 generates 3 PWM lines with complementary lines (with some deadtime) in center aligned m

I have ADC readings to sample the phases current.

Timer1 output trigger TRG0 is defined as update event, and the ADC external trigger conversion source is defined as Timer1 Trigger Out event.

However, in this configuration the ADC is triggered twice for each PWM period - once in the middle of the ON time, and one in the middle of the OFF time.

I want to receive only a single trigger for the ADC per PWM period (in the middle of either the on or off time) as the ADC conversion complete callback calls to my entire control algorithm.

How can I config it?

Thank you

    This topic has been closed for replies.
    Best answer by waclawek.jan

    Set up a channel to Output Compare with CCRx=0 or CCRx=ARR, and set the ADC to trigger on this channel (not all channels are available to serve as ADC trigger).

    JW

    2 replies

    Super User
    November 23, 2023

    Set up a channel to Output Compare with CCRx=0 or CCRx=ARR, and set the ADC to trigger on this channel (not all channels are available to serve as ADC trigger).

    JW

    Explorer II
    January 3, 2025

    Hello 

    I need this solution for my project .

    Please post the code or post Timer and ADC settings