68.6.6 PWM External Trigger Mode

The PWM channels 1 and 2 can be configured to use an external trigger for generating specific PWM signals to provide functions such as DC/DC converters, etc.

Figure 68-27. External Trigger Mode Block Diagram

The external trigger source can be selected through the bit TRGSRC of the PWM External Trigger Register (see the table below).

Table 68-6. External Event Source Selection
Channel Trigger Source Selection Trigger Source
1 PWM_ETRG1.TRGSRC = 0 From PWMEXTRG1 input
PWM_ETRG1.TRGSRC = 1 From Analog Comparator Controller
2 PWM_ETRG2.TRGSRC = 0 From PWMEXTRG2 input
PWM_ETRG2.TRGSRC = 1 From Analog Comparator Controller

Each external trigger source can be filtered by writing a one to PWM_ETRGx.TRGFILT.

When the external trigger event is detected, the internal counter of the PWM channel can be modified when conditions are met, depending on the value of the PWM_ETRGx.TRGMODE field.

Each time an external trigger event is detected, the corresponding PWM channel counter value is stored in PWM_ETRGx.MAXCNT if it is greater than the previously stored value. Reading PWM_ETRGx clears the MAXCNT value.

To adapt to different use cases, three different external trigger mode modes (ETM) are available for channels 1 and 2 depending on the value of the PWM_ETRGx.TRGMODE field:

The ETM feature is disabled when PWM_ETRGx.TRGMODE = 0.

The ETM mode can be associated with the recoverable fault mode (PWM_ETRGx.RFEN=1) to manage specific use case (see Cycle-By-Cycle Duty Mode: LED String Control).

The use cases described in the figures External PWM Start Mode: Buck DC/DC Converter and Cycle-By-Cycle Duty Mode are managed by PWM_ETRGx.RFEN=0.

The ETM must be enabled only if the corresponding channel is left-aligned (CALG = 0 in PWM Channel Mode Register of channel 1 or 2) and not managed as a synchronous channel (SYNCx = 0 in PWM Sync Channels Mode Register where x = 1 or 2). Programming the channel to be center-aligned or synchronous while TRGMODE is not 0 is forbidden.