This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PGE: PWM synchronization

Part Number: TM4C123GH6PGE

Hi,

for a project multiple channels are used to output PWM signal in parallel. The various PWM signals are very critical for the function.

The multiple channels should be time synchronized to start at simultaneously and preferrably not phase shifted (interleaved).

The synchronize function is known.

However currently a separate Assembler thread is used to modify the PWM to start simultaneously. This is not preferred since any possible skip/delay will damage the application.

Please support me in this.

Best Regards

Kevin

  • Hello Kevin,

    The key question here would be how many PWM's need to be started synchronized.

    From what I am seeing, the PWMGenEnable can be used to start a PWM pair that belongs to a specific generator block - so two PWM's channels - at the same time. To do more than that, I am not seeing a way to instantly synchronize on startup. That requirement might be too specific for a general purpose MCU. The provided synchronize options for the PWM peripheral work well and this issue of sync on start-up is not one I recall seeing being raised before even when dealing with PWM synchronization applications.

    Just to theorize for if they need more than two channels... maybe they could use a tri-state to hold the signal back until all generators are setup? Provided that the tri-state doesn't introduce some asynchronous behaviors itself.

  • Hello Ralph,

    Our small group - thru past experience - may prove useful in such, "Multi-Channel, Synchronized PWM Operation."

    We will document our belief via the:

    • Peripheral Driver Library's specific "PWM Sync." functions
    • actual "working code" our group had (long) past developed
    • in addition - we believe that the "Entire Content" of a PWM Module (i.e. 8 Channels) may be Synchronized!

    Driver Library exposes 2 key functions:   (both API Functions appear to "Directly Meet this poster's needs)

    21.2.2.9 PWMGenConfigure
    Description: This function is used to set the mode of operation for a PWM generator. The counting mode, synchronization mode, and debug behavior are all configured

    When the PWM generator parameters (period and pulse width) are modified, their effect on the output PWM signals can be delayed.   In synchronous mode, the parameter updates are not applied until a synchronization event occurs. This mode allows multiple parameters to be modified and take effect simultaneously, instead of one at a time.   Additionally, parameters to multiple PWM generators in synchronous mode can be updated simultaneously, allowing them to be treated as if they were a unified generator.

    21.2.2.35 PWMSyncTimeBase
    Synchronizes the counters in one or multiple PWM generator blocks.

    Now our poster noted, "The synchronize function is known."   Yet it appears that (even) w/that knowledge - poster sought (further) clarity & understanding.    It is believed this posting answers that need...

    And our past code:    (believed "Good for Gov't Work")

    // Configures two PWM generators for up/down counting mode, synchronous updates, and to stop at zero on debug events.  (again - all 4 'Gens' may //be accommodated)

    ROM_PWMGenConfigure(PWM0_BASE, PWM_GEN_0, (PWM_GEN_MODE_UP_DOWN |
    PWM_GEN_MODE_GEN_SYNC_LOCAL |
    PWM_GEN_MODE_DB_SYNC_LOCAL |
    PWM_GEN_MODE_FAULT_EXT | PWM_GEN_MODE_FAULT_MINPER |
    PWM_GEN_MODE_DBG_STOP));

    ROM_PWMGenConfigure(PWM0_BASE, PWM_GEN_2, (PWM_GEN_MODE_UP_DOWN |
    PWM_GEN_MODE_GEN_SYNC_LOCAL |
    PWM_GEN_MODE_DB_SYNC_LOCAL |
    PWM_GEN_MODE_FAULT_EXT | PWM_GEN_MODE_FAULT_MINPER |
    PWM_GEN_MODE_DBG_STOP));

    and

    // Synchronize the time base of the generators.
    //
    ROM_PWMSyncTimeBase(PWM0_BASE, PWM_GEN_0_BIT | PWM_GEN_2_BIT | PWM_GEN_3_BIT);   // these parameters are FAR from intuitive.   //We've 'renamed them' (not shown) & in that process FAR BETTER related the parameter to the specific PWM Generator Function...