iLLD_TC27xC  1.0
How to use the GTM TOM PWM Driver
Collaboration diagram for How to use the GTM TOM PWM Driver:

This driver implements the PWM functionalities as defined by Standard interface: Multi-channels, dual-complementary PWM interface. The user is free to use either the driver specific APIs below or to used the standard interface APIs.

Specific Implementation

The PWM driver is a concatenation of a timer with additional PWM generation cells.

The timer is implemented as described in TOM Timer Interface Driver, it generate an internal trigger that is used to synchronize all the TOM channel used (shown in red in the pictures below).

The picture below presents two configuration examples:

IfxGtm_Tom_PwmHl-0.png
PWM implementations on GTM TOM

Each of the TOM channel used for the generation of the CCx and COUTx signals are configured as in the figure below:

IfxGtm_Tom_PwmHl-1.png
TOM channel configuration

.

The internal trigger (red line) is generated by the timer on timer rest and used by the TOM PWM channels to reset the counters CN0 and transfer the shadow values saved in SR0 and SR1 to the CM0 and CM1 registers. When the counter CN0 reach the values of the CM0 or CM1 compare registers, a rising or falling edge is generated on the output PWM signal. The signal active state configuration define which of the CM0 or CM1 is generating the falling or rising edge.

This trigger mechanism ensure that all the PWM channels, period and trigger are updated at the exact same time, avoiding any possibility for glitch or incoherent signals.

The clock use is the same as the timer clock.

In order to ensure a coherent update of all registers, the internal trigger must be disable before updating the timer, trigger and PWM duty cycles shadow values, and enabled once the update is done. The transfer will ocucrs at the next timer reset.

Features

For a detailed configuration of the microcontroller, see IfxGtm_Tom_PwmHl_init().

Usage example

Initialisation is done by, e.g:

IfxGtm_Tom_PwmHl driverData;
IfxGtm_Tom_PwmHl_initConfig(&driverConfig, &MODULE_GTM);
IfxGtm_Tom_PwmHl_init(&driverData, &driverConfig);
IfxGtm_Tom_PwmHl_stdIfPwmHlInit(pwmhl, &driverData);

During run-time, the interface functions shall be used, e.g.:

Ifx_TimerValue onTime[3]; // assume configured for three HL channels
onTime[0] = 10;
onTime[1] = 20;
onTime[2] = 30;
IfxStdIf_Timer_setPeriod(timer, period);
IfxStdIf_PwmHl_setOnTime(pwmhl, onTime);